Skip to content

Instantly share code, notes, and snippets.

@nikasulo
Created August 24, 2019 22:23
Show Gist options
  • Save nikasulo/5e7f9cacb197fe89c4b2da6b4f269e82 to your computer and use it in GitHub Desktop.
Save nikasulo/5e7f9cacb197fe89c4b2da6b4f269e82 to your computer and use it in GitHub Desktop.
Compare the max to other numbers in the window
#check if the current item in the array is greater than what our max currently is
if max < array[i]
#if it is, first remove the max
remove_max(deque)
#now set the current index value of the array as the max
set_max(deque, array[i])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment