We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
For each hourglass, you are finding the sum. There are 16 sums you are finding. max needs to be whichever sum is the largest. So, inside your double for loop right when you calculate sum, you need to update max if you have found a sum that's bigger than your previous max, as so:
Java 2D Array
You are viewing a single comment's thread. Return to all comments →
For each hourglass, you are finding the sum. There are 16 sums you are finding. max needs to be whichever sum is the largest. So, inside your double for loop right when you calculate sum, you need to update max if you have found a sum that's bigger than your previous max, as so:
HackerRank solutions.