//LV2.이진변환 반복하기
public static int[] solution_repeat_binary(String s) {
int[] answer = new int[2];
answer[0] = 0;
answer[1] = 0;
while (s.length() > 1){
answer[0]++;
answer[1] += Arrays.stream(s.split("")).filter(a->"0".equals(a)).count();
s = Integer.toBinaryString(s.replace("0","").length());
}
return answer;
}
'Algorithm > Programmers' 카테고리의 다른 글
[Programmers] LV2. 주식가격 (0) | 2023.03.20 |
---|---|
[Programmers] LV2. 예상 대진표 (0) | 2023.03.17 |
[Programmers] LV2. 타켓넘버 (0) | 2023.03.17 |
[Programmers] LV2. 영어로 끝말잇기 (0) | 2023.03.15 |
[Programmers] LV2. 행렬의 곱셈 (0) | 2023.03.15 |