coding•DSA & Problem Solving•Strings & Hash Tables
Isomorphic Strings Verification
Problem Statement
Given two strings `s` and `t`, determine if they are **isomorphic**.
Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.
### Constraints
- `1 <= s.length <= 5 * 10^4`
- `t.length == s.length`
- `s` and `t` consist of any valid ascii character.
### Input Format
Two space-separated strings `s` and `t` on a single line.
### Output Format
Print `true` if isomorphic, otherwise `false`.
Sample Cases
Example 1Sample Case
Input: egg add
Output: true
Example 2Sample Case
Input: foo bar
Output: false
Example 3Sample Case
Input: e
Output:
Example 4Sample Case
Input: eg
Output:
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.