프로그래머스

[프로그래머스] 자연수 뒤집어 배열로 만들기_ JAVA

채니◟( ˘ ³˘)◞ 2023. 7. 13. 01:19

● 문제


● 풀이

import java.util.*;
import java.io.*;

class Solution {
    public ArrayList<Long> solution(long n) {
        
        ArrayList<Long> al = new ArrayList<>();
        
        while(n > 0){
            al.add(n%10);
            
            n/=10;
        }
        
        return al;
    }
}