leetle

Daily challenge for 2026-07-08

554. Locate Speed Limit Cruise

A smart car records its speed at regular intervals. The car accelerates strictly increasing its speed up to a certain point, after which the cruise control kicks in and the speed remains exactly constant until the end of the recording.

Given a list of integers speeds representing these recorded speeds, find the index where the cruise control first started (i.e., the first index where the speed reached its final constant value).

There will always be at least one acceleration step and at least two constant speed readings at the end.

Example:
Input: speeds = [10, 20, 30, 40, 40, 40]
Output: 3

Run this challenge interactively in Python or JavaScript when the app loads.