The seats still free
- O(1) · Trivial
- Free
- Python
- JavaScript
- operations
- division
Problem
For the field trip you rent vans with per_van seats, and only as many as you need: 10 people at 4 seats a van means three vans.
Write a function that takes how many people are going and how many fit in a van, and returns how many seats are still free in the vans you rented: how many more people you can invite without renting another one. If every van is full no seat is free, and if nobody is going none is.
Examples
10, 4 → 2
Every van full
12, 4 → 0
A single van
3, 5 → 2
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def free_seats(people, per_van):
passJavaScript
function freeSeats(people, perVan) {
}Solve this challenge
It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.