why get our min and max value at the time of pushing, ?
Easy way for it
i mean why dont we get our min and max value at the time of pushing that way it would be easier
You can try and code your idea as well. Check for some test cases, if it gives you the expected output.