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: <=
Smaller (or equal) values behind x can never be a window maximum again, so they are popped before x joins.
Play Problem Solving ▸