Java Easy Solution Using Stack
ComplexityTime complexity:
O(k), where k is the total number of digits in all numbers in the input array. Each digit is processed exactly once during the extrac


# Complexity
Time complexity:
O(k), where k is the total number of digits in all numbers in the input array. Each digit is processed exactly once during the extraction and once during the output construction.

Space complexity:
O(k) for storing the digits temporarily in the stack and list.

# Code
```java []
class Solution {
    public int[] separateDigits(int[] nums) {
        Stack<Integer> stack = new Stack<>(); // Temporary storage for digits
        List<Integer> list = new ArrayList<>(); // To store digits in order

        // Iterate over each number in the input array
        for (int num : nums) {
            // Extract digits and push them into the stack
            while (num != 0) {
                stack.push(num % 10);
                num /= 10;
            }
            // Pop digits from the stack to maintain the correct order
            while (!stack.isEmpty()) {
                list.add(stack.pop());
            }
        }

        // Convert the list of digits into an integer array
        int[] res = new int[list.size()];
        int idx = 0;
        for (int num : list) {
            res[idx++] = num;
        }

        return res;
    }
}

```
['Math', 'Stack', 'Java']