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 the first time i.e., at i==0 and j==0, there is no value for max_sum but we have only temp_sum. For all the remaining cases u will have max_sum wich u have stored in first iteration to verify which is big. So we added the condition i==0 && j==0 instead of assigning max_sum to a garbage value initially.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
For the first time i.e., at i==0 and j==0, there is no value for max_sum but we have only temp_sum. For all the remaining cases u will have max_sum wich u have stored in first iteration to verify which is big. So we added the condition i==0 && j==0 instead of assigning max_sum to a garbage value initially.