Algorithm · ByteDance · Medium
You are given a pair of non-negative integers: val and precise. Determine the square root of val without relying on any library routine that computes square roots. Produce the answer as a floating-point number whose decimal expansion is cut off, not rounded, after exactly precise fractional digits. Because truncation is used, the returned value's absolute difference from the exact square root is guaranteed to be at most $$10^{-precise}$$. After presenting the implementation,…
Checking your access…