728x90
😉 풀이
zero_count = 0
call_count = 0
def solution(s):
if s == '1': # 문자열 1 예외처리
return [0, 0]
q = []
q.append(s)
while q:
val = check(q.pop())
# 실행결과 확인
if val != '1':
q.append(val)
return [call_count, zero_count]
# 요구사항 로직 실행
def check(s):
global zero_count
global call_count
call_count += 1
zero_count += s.count('0')
new_str = bin(len(s.replace('0', ''))).replace('0b', '')
# print(f'new_str = {new_str}')
return new_str
✔️ 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/70129