다음 큰 숫자 (1) 썸네일형 리스트형 [프로그래머스] 다음 큰 숫자(JAVA) 문제는 이렇다 Integer.toBinaryString 을 이용하여 이진수를 문자열화 하면 쉽게 풀리겠구나 하고 풀었다. 다음은 내가 푼 답이다. package algorithm.programmers.level2; public class nextMaxNumber { public int solution(int n) { int answer = n+1; int nOneCount = oneCount(Integer.toBinaryString(n)); String resultBinary; int resultOneCount = 0; while(true){ resultBinary = Integer.toBinaryString(answer); resultOneCount = oneCount(resultBinary); if(.. 이전 1 다음