Elementwise Matrix Sum
Return the elementwise sum of two matrices of the same shape, given as arrays of rows.
addMatrices([[1, 2], [3, 4]], [[5, 6], [7, 8]]) -> [[6, 8], [10, 12]] addMatrices([], []) -> []
This is the first of three warm-ups in a data-science screen; the others count name frequencies and find the longest run of consecutive integers.
Hints
Hint 1
Two nested maps; the empty matrix falls out of them.
Topics
Asked at
Sign in to use the assistant — ask what the problem means, get a hint when you're stuck, or have your current work reviewed. Conversations save to your account.