Skip to the editor
JSGroundwork
JSGroundwork handwritten · web dev
←Back to Hashing

Ready to read

JSJavaScript⑂Git◎Interview prepΣDSA in JSSDSystem Design
More topics15›
</>HTML{ }CSS⚛ReactNNext.jsNeNest.jsTSTypeScriptNoNode.js🐳DockerDBSQL & Databases✓Testing🔒Web Security☁Cloud & DevOps◈GraphQL◆Redis☸Kubernetes
☰‹›
Description
All topics›JavaScript›Hashing

Isomorphic Strings

intermediatelayer B3 · Hashing5 tests

Two strings are isomorphic when you can rename the characters of the first to get the second: each character always maps to the same character, and no two characters map to the same one. Write isIsomorphic(s, t).

  • egg and add are isomorphic: e to a, g to d
  • foo and bar are not: o would have to be both a and r
  • badc and baba are not: two different letters would both map to a
  • Different lengths are never isomorphic; a character may map to itself

Stuck?

All exercisesPlayground
1234567891011121314
loading the editor…

Nothing yet — hit Run and whatever you log shows up here.

Submit to see how you did.

⌘/Ctrl + Enter run⌘/Ctrl + S save⌘/Ctrl + / comment⌘/Ctrl + F find/replace⌘/Ctrl + D select next matchAlt + click multi-cursorTab indent · ⇧Tab outdentEsc leave fullscreen