Closed ji-0630 closed 1 year ago
def solution(n, a, b):
answer = 1
a -= 1
b -= 1
while True:
lst = [i for i in range(0, int(n))]
if (lst.index(a) // 2) == (lst.index(b) // 2):
break
else:
a = int(lst.index(a) // 2)
b = int(lst.index(b) // 2)
answer += 1
n /= 2
return answer
def solution(n,a,b):
answer = 0
while a != b:
answer += 1
a, b = (a+1)//2, (b+1)//2
return answer
문제 설명