-Code
class Solution {
public int[] solution(long n) {
String num = String.valueOf(n);
int[] answer = new int[num.length()];
for (int i = 0; i < num.length(); i++) {
answer[i] = num.charAt(num.length() - i - 1) - '0';
}
return answer;
}
}
'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
[프로그래머스/Java] 문자열 내 p와 y의 개수 (0) | 2025.02.23 |
---|---|
[프로그래머스/Java] 두 정수 사이의 합 (0) | 2025.02.23 |
[프로그래머스/Java] 나머지가 1이 되는 수 찾기 (0) | 2025.02.23 |
[프로그래머스/Java] x만큼 간격이 있는 n개의 숫자 (0) | 2025.02.23 |
[프로그래머스/Java] 평균 구하기 (0) | 2025.02.23 |