What goes in the blank?
# next greater element with a monotonic stack of indexes
for i in range(len(nums)):
while stack and nums[stack[-1]] ____ nums[i]:
res[stack.pop()] = nums[i]
stack.append(i)
Answer: <
Every index still waiting on the stack whose value is smaller than nums[i] has just found its next greater element.
Play Problem Solving ▸