🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Monotonic Stack: all 13 questions

Quiz: Monotonic Stack · Question 2 of 13

For "next greater element", the stack (from bottom to top) is always:

For "next greater element", the stack (from bottom to top) is always:

  1. A.decreasing
  2. B.increasing
  3. C.sorted by index only, values in any order
  4. D.empty after every step
Answer & explanation

Correct answer: decreasing

Any element smaller than a newer one has been popped, so what remains decreases.

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 →