-
[💕 LeetCode Python] 461. Hamming DistanceAlgorithm/1일 1코테 2020. 10. 27. 13:30반응형
✍461. Hamming Distance✍
문제
leetcode.com/problems/hamming-distance/
내 답
def hammingDistance(self, x: int, y: int) -> int: # xor은 같으면 0, 다르면 1이므로 1의 갯수를 센다. return bin(x^y).count('1')
풀이
내 답이랑 똑같음
반응형'Algorithm > 1일 1코테' 카테고리의 다른 글
[💕 LeetCode Python] 191. Number of 1 Bits (0) 2020.10.27 [🤷♀️ LeetCode Python] 393. UTF-8 Validation (0) 2020.10.27 [💕 LeetCode Python] 136. Single Number (0) 2020.10.27 [💕 LeetCode Python] 240. Search a 2D Matrix 2 (0) 2020.10.26 [🤷♀️ LeetCode Python] 167. Two Sum 2 - Input array is sorted (0) 2020.10.26