As reported: Goldman Sachs Analyst CoderPad round (2025), second question: find the square root of
nwithout built-in functions, valid up to 2 decimal places.
Given a non-negative integer n, return √n truncated (not rounded) to exactly two decimal places, as a string like "1.41". Do not use a built-in square root or power function.
Example 1
n = 2
-> "1.41" (√2 = 1.41421…)
Example 2
n = 10
-> "3.16" (√10 = 3.16227…)
Constraints: 0 ≤ n ≤ 10^9.
Code runner format: one JSON value per line: n. Implement squareRoot(n); the harness prints the string as JSON.