Isomorphic Strings

Easy · Hashing · about 10 minutes

Asked at Amazon, Bloomberg, Google, Microsoft, Meta, LinkedIn, Grammarly.

Two strings s and t of the same length are isomorphic if the characters of s can be replaced to get t: every occurrence of a character maps to the same character, and no two different characters map to the same one (a character may map to itself). Return true if s and t are isomorphic.

Related guides