← Discussions on Isomorphic Strings
A aaravsingh OFFICIAL
24 Aug 2026, 18:39

Why does my solution TLE on the last test case?

Use a hash map from value to index (or count). For each element check whether its complement is already in the map, then insert it. That makes it O(n) instead of the O(n²) brute force.

0 replies

Sign in to reply.