Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t, where each character maps to exactly one other character and preserving order. No two characters may map to the same character.
s = "egg", t = "add"trues = "foo", t = "bar"falsesToT = {} and tToS = {} (bijection maps)i: get sc = s[i], tc = t[i]sToT[sc] exists and sToT[sc] ≠ tc → return falsetToS[tc] exists and tToS[tc] ≠ sc → return falsesToT[sc] = tc and tToS[tc] = scIsomorphic = one-to-one character mapping (bijection). A single map is insufficient — e.g. "ab"→"aa" would pass a one-direction check since both a and b map to a. Two maps enforce both directions: every s-char maps to exactly one t-char and every t-char maps back to exactly one s-char.