cswork / libraryOpen practice workspace

Interview experiences · Strava

Strava Software Engineer Interview Experience — Phone Screen: Climb Detection on Elevation Samples, Then Tolerating Partial Descents

Tech screenInterviewed 2026-09

Climb Detection Given an array of elevation samples taken at regular intervals, return the [startIndex, endIndex] of the first climb. Return [] if no climb exists. Part 1 — Strict Climb A climb: Starts when elevation begins increasing. Can stay flat. Cannot decrease. Ends at the highest elevation reached during the climb. Example: [3, 2, 1, 0, 0, 1, 2, 2, 3, 5, 10, 10, 7, 15] → [4, 10] Part 2 — T…

Climb Detection

Given an array of elevation samples taken at regular intervals, return the [startIndex, endIndex] of the first climb. Return [] if no climb exists.

Part 1 — Strict Climb

A climb:

  • Starts when elevation begins increasing.
  • Can stay flat.
  • Cannot decrease.
  • Ends at the highest elevation reached during the climb.

Example: [3, 2, 1, 0, 0, 1, 2, 2, 3, 5, 10, 10, 7, 15] → [4, 10]

Part 2 — Tolerate Partial Descent

Modify Part 1 so that a climb may temporarily descend and then continue.

A descent is allowed only if:

  • The elevation lost during the descent is ≤ 20% of the net elevation gained so far.
  • After the descent, the elevation eventually rises above the previous maximum elevation.

If both conditions are satisfied, the descent remains part of the same climb. Otherwise, the climb ends at the highest elevation reached before the descent.

Comments

Nothing here yet.

Join in on CSWork →