Approach Summary
Maintain two maps: s-char → t-char and t-char → s-char. Conflict in either direction → not isomorphic.
How to Recognize This Pattern
- "Can s be transformed to t by replacing chars consistently"
- Bijection: both directions must be consistent
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(1)
Tags
Hash Table String