|| C++ Solution 💻 || Easy 😊 || Explained🤔 || 100% Faster 🚀 || 
LeetCode Problem - Separate the Digits in an ArrayIntuitionThe first thought was to break each number into its individual digits and store them sequentially. Us
# LeetCode Problem - Separate the Digits in an Array


## Intuition
The first thought was to break each number into its individual digits and store them sequentially. Using string manipulation allows easy extraction of digits.

## Approach
1. Convert each number in the input array `nums` to a string.
2. Iterate through the characters of the string representation of each number.
3. Convert each character back to an integer and store it in the result array.
4. Return the resulting array containing all digits in order.

## Complexity
- **Time complexity:**  
  O(n * m), where `n` is the size of the input array and `m` is the average number of digits in the numbers.

- **Space complexity:**  
  O(k), where `k` is the total number of digits across all numbers in the input array.


# Code
```cpp []
class Solution {
public:
    vector<int> separateDigits(vector<int>& nums) {
        vector<int> ans{};
        int temp;
        for(int i=0;i<nums.size();i++){
            string str = to_string(nums[i]);
            for(auto c : str)
                ans.push_back(c-'0');
        }
    return ans;
    }
};
```
['C++']