Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 9x 1x 8x 2x 6x 6x 6x 21x 4x 17x 17x 2x | export default function isIsomorphic(s: string, t: string): boolean {
if (s.length !== t.length)
return false
if (s.length < 2)
return true
const encodeS = new Map<string, number>()
const encodeT = new Map<string, number>()
for (let i = 0; i < s.length; i++) {
if (encodeS.get(s[i]) !== encodeT.get(t[i]))
return false
encodeS.set(s[i], i)
encodeT.set(t[i], i)
}
return true
}
|