69. Sqrt(x)

 class Solution {

public:
    int mySqrt(int x) {
          long r = x;
    while (r*r > x)
        r = (r + x/r) / 2;
    return r;
    }
}

Comments

Popular posts from this blog

141. Linked List Cycle

67. Add Binary

88. Merge Sorted Array