Group Activity Timestamps into Consecutive-Day Intervals

Asked at Duolingo · Coding Questions · Difficulty: Medium · Last asked Nov 22, 2026

An app records a timestamp every time a learner finishes a lesson. To show the learner's activity history, it needs the stretches of calendar days on which they were active every day. A stretch ends on the first day with no lesson at all. Given the raw timestamps in any order, return every such stretch as a pair of dates.

Loading the problem…