$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #315

What goes in the blank?

# sliding-window maximum: keep a deque of indexes
# whose values are decreasing from front to back
while dq and nums[dq[-1]] ____ x:
    dq.pop()
dq.append(i)

Answer: <= (also accepted: <=, <)

Smaller (or equal) values behind x can never be a window maximum again, so they are popped before x joins.
Play Problem Solving ▸