#70 Isomorphic Strings
Two strings s and t are given. Determine whether they are isomorphic.
Two strings s and t are called isomorphic
if the characters in string s can be replaced to obtain string t, while:
- All occurrences of a replaced character must be replaced with the same replacement character.
- No two different characters may be replaced with the same character.
- A character may be replaced with itself.
/*
Examples:
s = "egg", t = "add" -> True
s = "foo", t = "bar" -> False
s = "paper", t = "title" -> True
*/
public boolean isIsomorphic(String s, String t) {
...
}
Question review
Sign in to start the dialogue
The mentor keeps the context of the current question and your previous messages.
Sign in
Available with Premium
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor