Skip to content

Instantly share code, notes, and snippets.

@nikasulo
Created August 24, 2019 22:57
Show Gist options
  • Save nikasulo/1c8ee8410b6700270eea73e7e460c280 to your computer and use it in GitHub Desktop.
Save nikasulo/1c8ee8410b6700270eea73e7e460c280 to your computer and use it in GitHub Desktop.
Check for runner ups
#check if what's currently in the back is a potential winner
if deque.topBack > array[i]
#if it is, store the runner up behind it
deque.pushBack(array[i])
else
#if it's not, remove it and then store the new winner in the back
deque.popBack
deque.pushBack(array[i])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment