public int solution(int n) {
int targetBitCount = Integer.bitCount(n);
for (int i = n + 1; i <= 1000000; i++) {
if (Integer.bitCount(i) == targetBitCount) {
return i;
}
}
return targetBitCount;
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/12911