We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5d9e79 commit ab64167Copy full SHA for ab64167
leetcode/String/No205.java
@@ -0,0 +1,26 @@
1
+class Solution {
2
+ public boolean isIsomorphic(String s, String t) {
3
+ if(s.length() <= 1 || s == null){
4
+ return true;
5
+ }
6
+ Map<Character,Character> hashMap = new HashMap<Character,Character>();
7
+ for(int i = 0;i < s.length();i++){
8
+ char a = s.charAt(i);
9
+ char b = t.charAt(i);
10
+ if(hashMap.containsKey(a)){
11
+ if(hashMap.get(a).equals(b)){
12
+ continue;
13
+ }else{
14
+ return false;
15
16
17
+ if(!hashMap.containsValue(b)){
18
+ hashMap.put(a,b);
19
20
21
22
23
24
25
26
+}
0 commit comments