Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

Possible sizes of bus to carry n groups of friends

There are n groups of friends, and each group is numbered from 1 to n. The ith group contains ai people. 
They live near a bus stop, and only a single bus operates on this route. An empty bus arrives at the bus stop and all the groups want to travel by the bus.