Daily Temperatures

Eight days of temperatures. For each day, how many days until a warmer one? Start scanning from day 1.

The Slow Way

For each day, scan rightward until you find a warmer one. Watch what happens to the first four bars.

To process just the FIRST 4 bars (indices 0, 1, 2, 3), roughly how many comparisons will brute-force scanning take?