[24.05.09] 내일배움캠프 18일차 JAVA TIL - 프로그래머스 자연수 뒤집기

2024. 5. 9. 20:06T.I.L

오늘 한 일

  • Web 강의 수강 - 심화강의
  • 발표 준비

 

 


class Solution {
    public int[] solution(long n) {
        String str = n + "";
        int len = str.length();
        int[] answer = new int[len];
        for(int i=0;i<len;i++){
            answer[i] = Integer.parseInt(str.substring(len-1-i,len-i));
        }
        return answer;
    }
}