135. Isomorphic Strings
Easy · String
Two strings are isomorphic if the characters in one string can be replaced to get the other string, while preserving the order of characters. A character must map to exactly one other character, and no two characters may map to the same character.
Given two strings s and t, determine if they are isomorphic.
Examples
Example 1 Input: s = "egg", t = "add" Output: true Explanation: The mapping e → a, g → d is valid and consistent. Each character in s maps to exactly one character in t.
Example 2 Input: s = "badc", t = "baba" Output: false Explanation: The character 'a' in s would need to map to both 'a' and 'b' in t, which violates the isomorphic property.
Constraints
- Standard input/output constraints apply