Summing integers as arrays

Question

Suppose you're given two arrays of length N, used to represent integer numbers. Each value in the represented integer is comma separated (ranging from 0-9) in the array. For example:

  • 15 is represented as [1,5]
  • 1200 is represented as [1,2,0,0]

Given this information, write a function that will sum the two arrays together for this representation. For example:

  • [8,8] + [1] = [8,9]
  • [9,5] + [1,6] = [1,1,1]

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now