L2 : 다음 큰 숫자 Python

jhyunn·2023년 1월 25일
0

Programmers

목록 보기
66/69

L2 : 다음 큰 숫자 Python

https://school.programmers.co.kr/learn/courses/30/lessons/12911

def solution(n):
    one_cnt = list(str(bin(n))).count('1')
    
    while 1:
        n += 1
        if list(str(bin(n))).count('1') == one_cnt:
            return n
profile
https://github.com/Sungjeonghyun

0개의 댓글