-
-
Save brentluna/3b7d1ececcec80b515c658a2d55951d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def push(val) | |
# By using a little extra memory, we can get the max simply by peeking, | |
# which is O(1). | |
@store.push({ | |
max: new_max(val), | |
min: new_min(val), | |
value: val | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment