Back to problems

Dasher Picker

Object-Oriented Programming · DoorDash · Medium

Implement a Dasher picker backed by a set of integer identifiers. The system exposes two operations: addDasher: Insert one new Dasher identifier. Begin with the set {0, 1, 2}; after one call, it should contain {0, 1, 2, 3}. pickDasher: Choose one identifier at random, remove it, and then renumber the remaining identifiers so they form a continuous range beginning at 0. For instance, starting with {0, 1, 2, 3}, removing 2 first produces {0, 1, 3}, which must then be…

Checking your access…