Ctrl K

Spell Out the Digits

Easy
You are given an array of positive integers numbers. Write each number out digit by digit from left to right and list all those digits in a row: first the digits of the first number, then those of the second, and so on. Return the resulting array of digits. For example, the number 3051 contributes [3, 0, 5, 1].
Example 1
numbers=[402, 7, 51] → [4, 0, 2, 7, 5, 1]

402 splits into 4, 0, 2, then comes 7, then 5 and 1, all in the original order.

Example 2
numbers=[100200] → [1, 0, 0, 2, 0, 0]

Zeros inside or at the end of a number are digits too and stay in the answer.

Example 3
numbers=[8, 3, 9] → [8, 3, 9]

One-digit numbers go into the answer unchanged.

Constraints
  • 1 ≤ numbers.length ≤ 1000
  • 1 ≤ numbers[i] ≤ 10⁹
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsHow Long the Light Stayed On EasyRepack the Tray EasyQuiz Score Log EasyMirror and Negate a Bitmap EasySwap Rows and Columns Easy
loading Python…
Input
numbers=[402, 7, 51]
Expected
[4, 0, 2, 7, 5, 1]

Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.