Separate the Digits in an Array

Given an array of positive integers nums, return an array answer that consists of the digits of each integer in nums after separating them in the same order they appear in nums.

To separate the digits of an integer is to get all the digits it has in the same order.

  • For example, for the integer 10921, the separation of its digits is [1, 0, 9, 2, 1].
Example 1
Inputnums = [13,25,83,77]
Output[1,3,2,5,8,3,7,7]
The separations are [1, 3], [2, 5], [8, 3], and [7, 7], concatenated in the same order.
Example 2
Inputnums = [7,1,3,9]
Output[7,1,3,9]
The separation of each integer in nums is itself, so the answer is unchanged.

Constraints

  • 1 <= nums.length <= 1000
  • 1 <= nums[i] <= 10^5

Asked at 3 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate