11. Isomorphic Strings
Last updated
Last updated
The problem can be found at the following link: Question Link
To determine if two strings are isomorphic,
I create two maps, mp1
and mp2
, to store the mapping from characters in str1
to str2
and vice versa.
I iterate through both strings simultaneously, updating the mappings.
If at any point, the mapping doesn't hold, I return false.
If the entire iteration completes without any mismatches, the strings are isomorphic.
Time Complexity: O(N)
, where N
is the length of the input strings.
Auxiliary Space Complexity: O(N)
, as we use two unordered maps.
For discussions, questions, or doubts related to this solution, please visit our discussion section. We welcome your input and aim to foster a collaborative learning environment.
If you find this solution helpful, consider supporting us by giving a ⭐ star to the getlost01/gfg-potd repository.