Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 421 Bytes

File metadata and controls

21 lines (17 loc) · 421 Bytes

프로그래머스 Level2 : Summer/Winter Coding(~2018) 점프와 순간 이동

public class Solution {
    public int solution(int n) {
        int answer = 0;
        
        while(n!=0){
            if(n%2!=0){
                answer++;
                n--;
            }
            n=n/2;
        }

        return answer;
    }
}