← 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?
- A.Indexes use less memory
- B.With an index you can still read the value, and also compute distances and positions
- C.Values can't be pushed in Python
- 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 →