Why store indices instead of temperatures?

Practice this question from Daily Temperatures - Monotonic stack Pattern Practice Quiz, with options and an explanation.

Question

Why store indices instead of temperatures?

Option A — Correct answer

To calculate the day distance

Option B

To sort values faster

Option C

To avoid arrays

Option D

To store only negatives

Explanation

The answer needs the distance between days.

Daily Temperatures - Monotonic stack Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker