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.
I set the value to None (Python 3) and set the max_value the first time it is calculated. Others have suggested that setting the value to -63 (7 * -9) is sufficient, which it is, but what happens when the spec changes (real world) and now we need to reset the initial max_value to whatever the lowest possible value could be.
integer.MIN_VALUE works as well. Generally I am against 'magic numbers' so None or the absolute lowest known value make the solution more scalable IMHO.
Cookie support is required to access HackerRank
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 set the value to None (Python 3) and set the max_value the first time it is calculated. Others have suggested that setting the value to -63 (7 * -9) is sufficient, which it is, but what happens when the spec changes (real world) and now we need to reset the initial max_value to whatever the lowest possible value could be.
integer.MIN_VALUE works as well. Generally I am against 'magic numbers' so None or the absolute lowest known value make the solution more scalable IMHO.