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

Why push indexes instead of values onto the stack?

Why push indexes instead of values onto the stack?

  1. A.Indexes use less memory
  2. B.With an index you can still read the value, and also compute distances and positions
  3. C.Values can't be pushed in Python
  4. D.It makes the stack increasing
Answer & explanation

Correct answer: With an index you can still read the value, and also compute distances and positions

Problems like daily temperatures need i − j, which only indexes give.

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 →