Problem 2622. Packing oranges - one layer
Help the seller to pack oranges efficiently. How many oranges can be put into a box in one layer without squeezing them?
Given dimension(s) return the maximum number. Assume that oranges are perfect spheres with unitary diameter.
Solution Stats
Problem Comments
-
4 Comments
Looks like 7 and 8 should use fit(x), not fit(x,y).
Sorry for that. Fixed now.
Every test is correct. The problem with the circle packing algorithm is precision. Set the precision wrongly and we will miss a lot of circles (It was fun to revisit this kind of problem). And btw, the upper bound for circle packing in the plane is pi/sqrt(12) of the total area. Ignore the spheres in the question, it's a circle packing problem ("easy" version, since we already have the radii).
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Determine whether a vector is monotonically increasing
21571 Solvers
-
Replace NaNs with the number that appears to its left in the row.
3017 Solvers
-
Calculate the Levenshtein distance between two strings
1463 Solvers
-
Calculate the height of an object dropped from the sky
259 Solvers
-
Mirror Image matrix across anti-diagonal
193 Solvers
More from this Author40
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!