GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesLongest Streak Calendar

Gamified challenge · Hash sets

Longest Streak Calendar

days lists the day numbers on which you worked out, in no particular order, and the same day may be logged more than once. A streak is a run of consecutive day numbers, like 4, 5, 6, 7.

Write longestStreak(days) (Python: longest_streak(days)) that returns the length of the longest streak. Repeats count once, and an empty logbook has a streak of 0.

Example: [5, 1, 3, 2, 10, 4, 11] contains days 1 to 5, so the answer is 5. Sorting works, but a hash set gets it done in O(n).

Sign in to play Longest Streak Calendar

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account