Intermediate Data Structures & Algorithms
Q70 / 100

What is a monotonic stack?

Correct! Well done.

Incorrect.

The correct answer is B) A stack maintained in strictly increasing or decreasing order, used for next-greater/smaller-element problems in O(n)

B

Correct Answer

A stack maintained in strictly increasing or decreasing order, used for next-greater/smaller-element problems in O(n)

Explanation

A monotonic stack processes each element once (O(n) total). It efficiently finds the next greater element, largest rectangle in histogram, and trapping rain water.

Progress
70/100