- Given two strings
s
andt
, determine ifs
is isomorphic tot
. - String
s
is isomorphic tot
if the letters ins
can be remapped to gett
. - Remapping a letter means replacing all occurrences of it in
s
with another letter. - A letter in
s
could only be mapped to one letter int
. - The ordering of the letters must remain unchanged.
- Given "egg", "add", return
true
. - Given "foo", "bar", return
false
. - Given "paper", "title", return
true
.
You may assume both s
and t
are lower case and have the same length.
This is an O(n) algorithm or better.