Skip to content

Commit aab99f6

Browse files
committed
Create 0205-isomorphic-strings.kt
1 parent 766ba49 commit aab99f6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: kotlin/0205-isomorphic-strings.kt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
fun isIsomorphic(s: String, t: String): Boolean {
3+
val hm = HashMap<Char, Char>()
4+
for(i in 0 until s.length){
5+
if(s[i] !in hm.keys){
6+
if(t[i] in hm.values) return false
7+
hm.put(s[i], t[i])
8+
}else if (hm.get(s[i]) != t[i]) return false
9+
}
10+
return true
11+
}
12+
}

0 commit comments

Comments
 (0)