Two strings are isomorphic when the characters of s can be replaced one-to-one to get t.
s
t
No two characters may map to the same character, and a character may map to itself.
s = "egg", t = "add"
true
Why
e → a and g → d.
s = "foo", t = "bar"
false
1 <= s.length <= 5 * 10^4 s.length === t.length
Topics
Implement isIsomorphic in the editor and return the answer — printing it is never graded.
isIsomorphic
Problem 33 of 1146 in the arena