An image gallery wants to arrange count thumbnails in the largest full square grid it can: a side × side grid with every cell filled. Extra thumbnails are shown on a second screen.
Write squareSide(count) that returns the largest whole number side with side * side <= count.
Don't use Math.sqrt: search for the answer.
Input: count = 10 Output: 3
A 3 by 3 grid uses 9 thumbnails. 4 by 4 would need 16.
Input: count = 16 Output: 4
16 thumbnails fill a 4 by 4 grid exactly.
0 <= count <= 2^31 - 1Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #172 Largest Square Tile. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.