프로그래머스 Summer/Winter Coding(~2018) 점프와 순간 이동 [JAVA] - 22년 9월 14일

Denia·2022년 9월 14일
0

코딩테스트 준비

목록 보기
68/201
package com.company;

public class Solution {
    public int solution(int n) {
        int answer = 0;

        while(n != 0) {
            if(n % 2 == 1) answer++;

            n /= 2;
        }

        return answer;
    }
}

profile
HW -> FW -> Web

0개의 댓글