n. You need to place n identical unit-cube crates inside it.
Crates can go anywhere on the floor. A crate may be put on top of another crate only if each of the four vertical sides of the lower crate is against a wall or another crate.
Return the smallest possible number of crates standing on the floor.n=4 → 3
Put three crates in the corner in an L shape: the corner crate touches a wall on two sides and a neighbour on the other two. The fourth crate goes on top of it.
n=11 → 7
A corner pyramid of 6 + 3 + 1 = 10 crates rests on 6 floor crates. One more crate needs a seventh crate on the floor.
n=1 → 1
n ≤ 10⁹n=4
3
Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.