Editor

Python sorting and searching problems

Sort, search and binary search in Python, on problems with tests that check your solution at once.

Beginner

  1. 50. Binary SearchWhere does this number sit in a long sorted list?45 XP8 min
  2. 258. First Failing BuildWhich build broke everything, found with only a few checks?45 XP10 min

Intermediate

  1. 60. Integer Square RootSquare roots of enormous numbers, exact to the last digit60 XP10 min
  2. 75. Sort by FrequencyLine up a list by how often each value turns up65 XP10 min
  3. 83. K-th Largest ItemWho came in k-th place on an unsorted scoreboard?70 XP12 min
  4. 89. First and Last PositionWhere does a run of repeated values start and stop?75 XP15 min
  5. 265. A Researcher's H-IndexOne number that sums up how often a scientist's papers get cited60 XP10 min
  6. 316. Find the PeakA mountain road climbs, then drops: where exactly is the top?75 XP14 min
  7. 319. Rank the LeaderboardTwo players tie for second place. So who comes third?75 XP15 min

Advanced

  1. 143. Minimum Reading SpeedHow slowly can you read and still finish every book in time?130 XP25 min
  2. 157. Search a Rotated Sorted ListA sorted list was cut in two and its halves swapped140 XP25 min
  3. 167. Count InversionsHow far is this list from being sorted?165 XP35 min
  4. 394. Spread Out the SensorsPlace the sensors so that even the closest two are far apart140 XP30 min
  5. 411. K-th Number in a Times TableA giant times table in sorted order: which number sits in position k?150 XP30 min
  6. 417. Split a Long Hike Into DaysA long trail and a set number of days: make the hardest day as short as you can150 XP30 min

Expert

  1. 199. Median of Two Sorted ListsThe middle value of two sorted lists put together280 XP50 min
  2. 466. K-th Smallest Pair DistanceEvery pair of houses on a long road, sorted by distance: which gap is k-th?240 XP45 min
  3. 490. Stretches With a Total in RangeHow many runs of days ended with a total inside the target band?260 XP50 min

Other topics

Or see every challenge, with study plans, today's challenge and duels.