← Quiz: Monotonic Stack: all 13 questions
Quiz: Monotonic Stack · Question 12 of 13
In the largest rectangle in a histogram, how wide can the rectangle that uses bar i's full height be?
In the largest rectangle in a histogram, how wide can the rectangle that uses bar i's full height be?
- A.Always the whole histogram
- B.Exactly one bar
- C.It stretches from just after the previous smaller bar to just before the next smaller bar
- D.Twice the height of bar i
Answer & explanation
Correct answer: It stretches from just after the previous smaller bar to just before the next smaller bar
A shorter bar on either side stops the rectangle, and the monotonic stack finds both boundaries.
Can you get the rest right without peeking?
Take the timed Quiz: Monotonic Stack quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →