The question is confusing and possibly not worded correctly. Let me clarify. If we have a 2-dimensional array vector<vector<int>> A = {{i, j, k}, {x, y, z}}
. What is the fastest way to find a 1-dimensional array C such that that vector<int> C = {i + x, j + y, k + z}
?
Additionally, in the problem I'm working on, I will have to carry numbers ie if we have a sum of 25, 2 will have to be carried into the next sum and 5 will remain as the current sum.
I've tried to use a for loop. However, it's very tedious and quite slow for large arrays.
Hopefully, there are some helpful functions out there?