Sqrt(x)
Implement int sqrt(int x).
Compute and return the square root of x.
First thought: use long long, inefficient. Also, some conditions are unnecessary. However, the following code still passes the large judge.
Modified version: Thanks 六根清净 for providing a helpful binary search framework!
First thought: use long long, inefficient. Also, some conditions are unnecessary. However, the following code still passes the large judge.
Modified version: Thanks 六根清净 for providing a helpful binary search framework!
Comments
Post a Comment