Skip to content

Commit fb6ba0e

Browse files
committed
461/kt
1 parent c9aa01f commit fb6ba0e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

461.hamming-distance.0.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* @lc app=leetcode id=461 lang=kotlin
3+
*
4+
* [461] Hamming Distance
5+
*/
6+
class Solution_hammingDistance_0 {
7+
fun hammingDistance(x: Int, y: Int): Int {
8+
return x.toString(2).padStart(32, '0').zip(y.toString(2).padStart(32, '0')).filter { it.first != it.second }.size
9+
}
10+
}

0 commit comments

Comments
 (0)