Puzzle Spree

Puzzle Spree

Recycling Server Pool

Efficiently manage server IDs by recycling exploded servers

Kuai Yu's avatar
Kuai Yu
Feb 21, 2025
∙ Paid

You manage a pool of servers numbered sequentially starting from 1. Over time, some servers might “explode,” freeing up their number for future use. When launching a new server, your goal is to assign it the smallest available number.

Implement a class with the following methods:

  • Constructor: Accepts a list of currently allocated server numbers.

  • next_serve…

Keep reading with a 7-day free trial

Subscribe to Puzzle Spree to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Puzzle Spree · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture