알고리즘
[프로그래머스] 이진 변환 반복하기
hminor
2023. 6. 2. 22:09
반응형
def solution(s):
binary_cnt = zero_cnt = 0
while s != '1':
zero_cnt += s.count('0')
s = bin(len(s.replace('0', ''))).lstrip(('0b'))
binary_cnt += 1
return [binary_cnt, zero_cnt]