https://programmers.co.kr/learn/courses/30/lessons/12985
#include <iostream>
using namespace std;
int solution(int n, int a, int b)
{
int answer = 1;
int mini = min(a, b);
int maxi = max(a, b);
while(mini%2 == 0 || maxi - mini != 1){
if(mini % 2 == 0) mini /= 2;
else mini = mini/2 + 1;
if(maxi % 2 == 0) maxi /= 2;
else maxi = maxi/2 + 1;
answer ++;
}
return answer;
}
#include <iostream>
using namespace std;
int solution(int n, int a, int b)
{
a--;
b--;
int answer=0;
while(a!=b){
a=a/2;
b=b/2;
answer++;
}
return answer;
}