📚 Stack || Easy To Understand
Upvoting is Much Appreciated  *\n\nclass Solution {\n    public int[] separateDigits(int[] nums) {\n      LinkedList<Integer>stack=new LinkedList();\n        Ar
**Upvoting is Much Appreciated  ***\n```\nclass Solution {\n    public int[] separateDigits(int[] nums) {\n      LinkedList<Integer>stack=new LinkedList();\n        ArrayList<Integer>arr=new ArrayList();\n        for(int i:nums){\n            while(i>0){\n                stack.push(i%10);\n                i/=10;\n            }\n            while(!stack.isEmpty()){\n            arr.add(stack.pop());\n            }\n        }\n        int []ans=new int[arr.size()];\n        for(int i=0;i<arr.size();i++){\n            ans[i]=arr.get(i);\n        }\n        return ans;\n    }\n}\n```
['Java']