Challenges
A goal and tests, nothing else. Warm-up, Core and Stretch, in every language.
Python
- Longest win streakGiven a season of match results, find the longest run of wins in a row.Warm-upDone
- A chat filterHide banned words in a game chat message with stars, whatever their capital letters, and leave every other word alone.CoreDone
- Merge two game inventoriesTwo players pool their loot. Merge two inventory dictionaries into a new one, add up shared items and cap each stack at 99.CoreDoneBrainlag Code
- A leaderboard of best scoresTurn a log of every round played into a top-N leaderboard: one row per player, their best score, ties in name order.CoreDoneBrainlag Code
- Build a football league tableRead match results like "Lions 2-1 Tigers", award points, and sort the table by points, goal difference and name.StretchDoneBrainlag Code
- Find timetable clashesGiven a week of clubs and lessons with start and end times, find every pair that overlaps on the same day.StretchDoneBrainlag Code
Web
- Count the hashtagsGiven a feed of posts with hashtags, count how often each tag is used, the way a trending list or a tag cloud does.Warm-upDone
- Playlist lengthTurn seconds into the 3:05 and 1:02:05 times music apps show, then add up a whole playlist from its track lengths.CoreDone
- Basket total with discount codesWork out what an online shop charges: item prices times quantities, delivery, and three kinds of discount code.CoreDoneBrainlag Code
- Leaderboard ranks with tiesSort a game's players by points and give each one a rank, where players on the same points share a rank, like a real leaderboard.CoreDoneBrainlag Code
- A chat filterClean up a game's chat log: drop muted users, mask banned words with stars, and hide copy-paste spam.StretchDoneBrainlag Code
- A chat rate limiterStop spam in a chat app by letting each user send only a few messages in any rolling time window, using timestamps.StretchDoneBrainlag Code
SQL
- Find the busiest hour at the tuck shopA week of school tuck shop sales with a time on each one. Work out which hour of the day is the busiest so the shop knows when to open a second till.Warm-upDone
- Rank artists by listeners outside the UKA UK label wants to know which artists travel. Count how many different listeners outside the UK each artist reaches, not how many plays.CoreDone
- Find games bought and never playedMatch a launcher's purchases against its play sessions to find every game someone paid for and has not opened once.CoreDoneBrainlag Code
- Find timetable clashes for Year 12Year 12 chose their option classes. Join the timetable to itself to find every student who is meant to be in two rooms at once.CoreDoneBrainlag Code
- Suggest accounts to followThe "people you may know" list on a social app: accounts followed by the people you follow, ranked by how many of them follow it.StretchDoneBrainlag Code
- Build the league table from match resultsTurn a season of football scores into a proper league table: played, won, drawn, lost, goals for and against, goal difference and points, as a view.StretchDoneBrainlag Code
C
- A health bar that stays in rangeApply a hit or a heal to a health bar and keep the result between 0 and the maximum, whatever the numbers.Warm-upDone
- Reverse a playlist in placeFlip the order of a playlist array without making a second array, by swapping from both ends towards the middle.CoreDone
- Turn a clock time into minutesParse a time like "12:45" into minutes after midnight, character by character, and reject anything that is not a real time.CoreDoneBrainlag Code
- The last five scoresKeep only the most recent five match scores in a fixed array that wraps around, the ring buffer behind every "recent games" panel.CoreDoneBrainlag Code
- Find a player by ID, fastSearch a sorted array of 100,000 player IDs with binary search, halving the range each step, and prove it with a step counter.StretchDoneBrainlag Code
- Compress a level rowSquash a row of a tile map like "####....##" into "4#4.2#" with run-length encoding, writing into a buffer the caller gives you.StretchDoneBrainlag Code