Analysis
- Use binary search to find the square root
Note
- Just like calculate the average of two integer, it should use mid = low + (high - low)/2
- because of needing calculating mid * mid, mid should be defined as long long
- Each calculation must consider the overflow
No comments:
Post a Comment
Enter you comment