You are viewing a single comment's thread. Return to all comments →
Considering that one of the problem constrians is -9 <= arr[i][j] <= 9
You can consider that the lowest Hourglass value will be the one where all the 7 values are -9.
Considering this, you only need to initialize max_value to -63 should be enough.
I didn't realize of that until I resolve the problem, using C++ INT_MIN, and read the editorial.
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 →
Considering that one of the problem constrians is -9 <= arr[i][j] <= 9
You can consider that the lowest Hourglass value will be the one where all the 7 values are -9.
Considering this, you only need to initialize max_value to -63 should be enough.
I didn't realize of that until I resolve the problem, using C++ INT_MIN, and read the editorial.