hammingweight (1) 썸네일형 리스트형 [비트연산] 릿코드 Easy 191 'Number of 1 Bits' (Python) https://leetcode.com/problems/number-of-1-bits/ Number of 1 Bits - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 정수로 들어온 값을 2진수로 바꿔주고 1의 개수를 센다 class Solution: def hammingWeight(self, n: int) -> int: return str(bin(n)).count('1') 이전 1 다음