A fabrication shop cuts the biggest possible square tile whose area does not exceed a given sheet area A. Because tools only cut integer side lengths, you must find the largest non-negative integer s such that s * s <= A. This is exactly the floor of the square root of A.
Line 1: a single integer A.
A single integer: the largest s with s * s <= A.
Example 1
Input
17
Expected
4
Explanation
4*4 = 16 <= 17 but 5*5 = 25 > 17, so the largest side is 4.
Example 2
Input
1000000000000000000
Expected
1000000000
Explanation
1000000000 squared is exactly 10^18, so the largest side is 1000000000.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →