Same Pattern Words
Two strings are isomorphic if the characters of s can be replaced to get t, where each character maps to exactly one character and no two characters map to the same one. Return True if s and t are isomorphic.
Constraints
-
len(s)len(t)
Examples
EXAMPLE WALKTHROUGHisomorphic
A guided view of the published example, not a trace of your code.
INPUT
["egg","add"]TASKsame_pattern_words()
EXPECTED OUTPUT
trueStart with the input values shown in this example.
Example 1 of 3
Input: s = "egg", t = "add"
Output: true
Explanation: isomorphic
Input: s = "foo", t = "bar"
Output: false
Explanation: o maps twice
Input: s = "paper", t = "title"
Output: true
Explanation: longer
Hint 1
Keep two dictionaries, one in each direction, and check consistency.