The tiles that fit
- O(1) · Trivial
- Free
- Python
- JavaScript
- operations
- division
Problem
You're covering a wall tall by wide centimeters with square tiles of side centimeters. They go up in even rows and you can't cut them: the strip left over at the edge stays bare.
Write a function that returns how many whole tiles fit.
On a wall 10 by 9 with tiles of 4, four tiles fit: two rows of two.
If the tile is bigger than the wall, none fits and you return 0.
Examples
An exact wall
10, 8, 2 → 20
Leftovers on both edges
10, 9, 4 → 4
The tile doesn't fit
5, 3, 6 → 0
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def tiles(tall, wide, side):
passJavaScript
function tiles(tall, wide, side) {
}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.