Four Passengers and a Driver

Published by Thomas Sandell in

A typical car can hold four passengers and one driver, allowing five people to travel around. Given n number of people, return how many cars are needed to seat everyone comfortably.

Examples

carsNeeded(5) ➞ 1

carsNeeded(11) ➞ 3

carsNeeded(0) ➞ 0

Notes

It's likely there will be a few people left over and some cars won't be filled to max capacity.

Watch a quick demo on how Edabit works.