[프로그래머스 Lv2] 이진 변환 반복하기(python, 구현)
·
CodingTest/Programmers
문제링크: https://school.programmers.co.kr/learn/courses/30/lessons/70129 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krdef solution(s): cnt = 0 zero_cnt = 0 while s != "1": cnt += 1 zero_cnt += s.count("0") s = s.replace("0", "") length = len(s) binary = bin(length)[2:] s = binary return [cnt, zero_c..