🎙 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 10 of 13

After the loop, what do the indexes still left on the "next greater" stack mean?

After the loop, what do the indexes still left on the "next greater" stack mean?

  1. A.Those elements have no greater element to their right
  2. B.Those elements are the largest in the array
  3. C.Those elements were processed twice
  4. D.The algorithm failed for them
Answer & explanation

Correct answer: Those elements have no greater element to their right

Nothing larger came after them, so their answer stays at the default −1.

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 →