Decimal Digits in Order
Problem statement
Return the decimal digits of value from most significant to least significant. Ignore a negative sign. The value zero has the single digit 0.
Function
decimalDigits(value: long) → int[]Examples
Example 1
value = 0return = [0]The decimal magnitude directly determines the ordered digit sequence.
Example 2
value = 7return = [7]The decimal magnitude directly determines the ordered digit sequence.
Example 3
value = 42return = [4,2]The decimal magnitude directly determines the ordered digit sequence.
Constraints
-10^18 <= value <= 10^18.
Source note: Author-written prompt excerpt retained for source fidelity.