DEV Community

Discussion on: Daily Challenge #87 - Pony Express

Collapse
 
benstigsen profile image
Benjamin Stigsen

In Python:

from math import ceil

def countRidersNeeded(stations, max_distance):
    distance = 0
    for i in stations:
        distance += i

    return ceil(distance / max_distance)

print(countRidersNeeded([43, 23, 40, 13], 100))