Monotonic Structures Checkpoint

Trace fresh cases, diagnose a failed invariant, then revisit the linked explanation and implementation.


Get every question correct to pass this checkpoint. You can review feedback, revise your answers, and submit again.

1. In [2,5,3,6], the next strictly greater element after value 5 is what? Answer with the integer only.
2. A histogram bar of height h is popped at index i, leaving index j on the stack. What width is available to h?

Select one answer.

3. What is the largest rectangle area in histogram [2,2,2]? Answer with the integer only.
4. An increasing histogram ends with several bars still on the stack. What must happen?

Select one answer.

5. A next-greater algorithm uses >= as its pop rule when the task asks for strictly greater values. What can go wrong?

Select one answer.

6. A histogram uses strict pop on a lower incoming height. After popping height 5, the new stack top also has height 5. Is the trace necessarily wrong?

Select one answer.

Join Discord