Sum All Ordered Decimal Concatenations
Problem statement
Given positive integers values, consider every ordered pair of elements, including pairing an index with itself. Concatenate their decimal representations in pair order and return the sum of all resulting numbers.
Function
sumOrderedConcatenations(values: int[]) → longExamples
Example 1
values = [2,10,3]return = 1845The nine ordered concatenations sum to 1845.
Example 2
values = [7]return = 77The only ordered pair concatenates 7 with itself.
Constraints
1 <= values.length <= 1000001 <= values[i] <= 1000000000- The answer fits in a signed 64-bit integer.