Drill

ProblemsPython › machines

Spares to keep for a fleet

easymachinesPython

To scale a fleet safely, buying 10% extra units as spares keeps the line alive while one fails. Return the total units to purchase.

spares_for_scale(units: int) → int

Solve it in the editor →

Where you start

def spares_for_scale(units: int) -> int:
    

Worked examples

CallResult
spares_for_scale(100)110
spares_for_scale(1)2
spares_for_scale(0)0
spares_for_scale(10)11

Hint

Ceiling of ten percent in integers is (units + 9) / 10.

Reference solution in Python
def spares_for_scale(units: int) -> int:
    return units + (units + 9) // 10

The same problem in another language

More machines problems in Python