← back to unit
Challenge
# puzzle gauntlet advanced
The Leaderboard Insert
The arcade leaderboard shows the top 5, best first. New scores stream in all day. Keep it correct! 🕹️
You get the current top-5 board (descending) and the stream of new scores. For each new score: find its spot, slide it in, drop whoever falls off the bottom (scores matching an existing entry go BELOW it). Print the final board, comma-separated.
Example:
Input: board = [90, 70, 50, 30, 10], stream = [60, 95]
Output: 95,90,70,60,50
60 slides in ahead of 50 (board: 90,70,60,50,30, dropping 10), then 95 slides in ahead of 90 (board: 95,90,70,60,50, dropping 30).
💡 need a hint?
pg-leaderboard-insert.py🔒 given lines are locked — write your code in between
loading...