Skip to content

Commit

Permalink
Sync LeetCode submission - Valid Anagram (kotlin)
Browse files Browse the repository at this point in the history
  • Loading branch information
hucancode committed Dec 16, 2023
1 parent 0c7388b commit 833e2e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions leetcode/problems/valid_anagram/solution.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Solution {
fun isAnagram(s: String, t: String): Boolean {
val a = IntArray(26)
val b = IntArray(26)
for(c in s) a[c-'a']++
for(c in t) b[c-'a']++
return a contentEquals b
}
}

0 comments on commit 833e2e1

Please sign in to comment.