The Separate the Digits in an Array interview question gives you an array of positive integers. For each number in the array, separate it into its individual digits and insert them into a new array in the same left-to-right, most-significant-to-least-significant order. Return the new array containing all digits from all numbers in order. This is a straightforward simulation problem.
Meta asks this as a beginner-level warm-up to test string-to-integer conversion, digit extraction order, and list building. It validates that candidates can cleanly decompose numbers into digits while preserving the original array ordering and digit ordering within each number. The problem also distinguishes candidates who use string conversion (cleaner) from those who use modulo/division (reversed order without extra steps).
The pattern is digit extraction via string conversion. For each number n in the array, convert it to a string str(n), iterate over each character, convert back to int, and append to the result list. This preserves the natural digit order (most significant first). Alternatively, use divmod with digit reversal, but string conversion is cleaner. Result has exactly sum(number of digits in each element) entries.
Input: [13, 25, 83, 77]
Processing:
Result: [1, 3, 2, 5, 8, 3, 7, 7].
Input: [100, 10, 1]:
[1, 0, 0, 1, 0, 1].while n > 0: d = n % 10; n //= 10 extracts digits in reverse (least significant first). Must reverse before extending the result.int(c) is needed after string conversion — str(n) yields strings '1', '2', etc.; convert back to int before appending.For the Separate the Digits in an Array coding problem, the array simulation interview pattern is the foundational skill. In Python, [int(d) for n in nums for d in str(n)] solves this in one line. Meta interviewers use this as a 2-minute problem — solve it instantly and move to discussing follow-ups like "what if we need digits in reverse order?" or "what if numbers can be negative?" Knowing how to handle edge cases cleanly (zeros mid-number, single-digit numbers) shows production-quality thinking.