def ChangeAndCount(n):
a = ""
while n > 1:
a += str(n % 2)
n = n//2
a += "1"
return a.count("1")
def solution(n):
num_1 = ChangeAndCount(n)
while True:
n = n+1
if ChangeAndCount(n) == num_1:
return n'파이썬 코딩테스트 > 프로그래머스' 카테고리의 다른 글
| 프로그래머스 / 영어 끝말잇기 / 파이썬 (0) | 2022.10.06 |
|---|---|
| 프로그래머스 / 짝지어 제거하기 / 파이썬 (0) | 2022.10.06 |
| 프로그래머스 / 피보나치 수 / 프로그래머스 (0) | 2022.09.17 |
| 프로그래머스 / 숫자의 표현 / 파이썬 (0) | 2022.09.17 |
| 프로그래머스 / 최솟값 만들기 / 파이썬 (0) | 2022.09.17 |