摘要:
Implement int sqrt(int x). 这道题本质上是求sqrt(x)下最大的整数。二分查找是比较容易想到的方法。另,在网上又学习了下别人的牛顿迭代法。 这是我原来的写法,写入是错误的,复杂度太高 class Solution {
public: int sqrt(int x) { if (x > 1; int index = ... 阅读全文
posted @ 2015-03-19 11:36
程序员小王
阅读(138)
评论(0)
推荐(0)
浙公网安备 33010602011771号