← Isomorphic Strings
Discussions
Sign in to join the discussion.
R
riyachatterjee
OFFICIAL
1 month, 3 weeks ago
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.
💬 2 replies
A
aaravsingh
OFFICIAL
3 months, 1 week ago
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
G
gurpreet_42
6 months ago
Intuition + complexity breakdown for Isomorphic Strings.
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.
💬 1 reply