코딩테스트 연습 - 이진 변환 반복하기 | 프로그래머스 스쿨 (programmers.co.kr)
문제 설명
제한사항
나의 풀이
def solution(s):
count=0
count_zero=0
while s!="1":
count+=1
count_zero+=s.count('0')
s=s.replace('0','')
c=len(s)
s=bin(c)[2:]
return [count, count_zero]
모범 답안
'코딩테스트 > programmers (python)' 카테고리의 다른 글
Programmers / 2단계 / 짝지어 제거하기 / python (0) | 2024.01.29 |
---|---|
Programmers / 2단계 / N개의 최소공배수 / python (0) | 2024.01.28 |
Programmers / 1단계 / 달리기 경주 / python (0) | 2024.01.27 |
Programmers / 1단계 / 개인정보 수집 유효기간 / python (1) | 2024.01.27 |
Programmers / 1단계 / 바탕화면 정리 / python (1) | 2024.01.26 |