You are viewing a single comment's thread. Return to all comments →
I think more general and better solution is to declare maxSum outside of loop and then after calculating sum add:
// on first iteration save sum to compare if (y === 0 && x === 0) maxSum = sum;
This sets maxSum to first calculated sum, whatever it is.
Seems like cookies are disabled on this browser, please enable them to open this website
2D Array - DS
You are viewing a single comment's thread. Return to all comments →
I think more general and better solution is to declare maxSum outside of loop and then after calculating sum add:
This sets maxSum to first calculated sum, whatever it is.