FastPrepSum All Ordered Decimal Concatenations

Sum All Ordered Decimal Concatenations

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated

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[]) → long

Examples

Example 1

values = [2,10,3]return = 1845

The nine ordered concatenations sum to 1845.

Example 2

values = [7]return = 77

The only ordered pair concatenates 7 with itself.

Constraints

  • 1 <= values.length <= 100000
  • 1 <= values[i] <= 1000000000
  • The answer fits in a signed 64-bit integer.

More ZipRecruiter Online Assessment questions

Similar questions at other companies

ZipRecruiter interview experiences

All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public long sumOrderedConcatenations(int[] values) {
        // Write your code here.
    }

}
Checking account…