[Programmers] 점프와 순간 이동
Python
def solution(n):
ans = 0
while n > 0:
if n % 2 == 0:
n = n // 2
else:
n = n - 1
ans += 1
return ans
def solution(n):
ans = 0
while n > 0:
if n % 2 == 0:
n = n // 2
else:
n = n - 1
ans += 1
return ans
댓글남기기