The TransCompilator

Solved LeetCode program · 69 of 1,000

#0069 · Sqrt(x)

Easy Math chunk-02.md

Original English source

The target is 8. The low is 0. The high is target. The answer is 0.
Repeat while low is at most high.
The middle is the midpoint of low and high. If middle times middle is at most target, set answer to middle, set low to one more than middle, otherwise set high to one less than middle.

Show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

2