전체 코드
4장/자연수_뒤집어_배열로_만들기.java
public class Solution {
public int[] solution(long n) {
String str = Long.toString(n);
String reversed = new StringBuilder(str).reverse().toString();
char[] arr = reversed.toCharArray();
int[] result = new int[arr.length];
for (int i = 0; i < result.length; i++) {
result[i] = arr[i] - '0';
}
return result;
}
}