JAVA | Easy solution | Explained ✅
---\n# Please Upvote \uD83D\uDE07\n---\njava []\nclass Solution {\n    public int[] separateDigits(int[] nums) {\n        List<Integer> ans = new ArrayList<>();
---\n# Please Upvote \uD83D\uDE07\n---\n``` java []\nclass Solution {\n    public int[] separateDigits(int[] nums) {\n        List<Integer> ans = new ArrayList<>();\n        for (int i : nums) {\n            // for every number in nums, \n            // we would add digit by digit to this new list\n            List<Integer> list = new ArrayList<>();\n            while (i > 0) {\n                // get the last digit, add to first position\n                list.add(0, i % 10);    \n                i /= 10;     // get rid of last digit\n            }\n            // add all the digits in answer list\n            ans.addAll(list);\n        }\n        \n        // return the answer list as an array\n        return ans.stream().mapToInt(i -> i).toArray();\n    }\n}\n```\n##### Time complexity: $$O(n)$$\n##### Space complexity: $$O(n)$$\n
['Java']