摘要: Implementint sqrt(int x).Compute and return the square root ofx.求平方根, 用的是二分法. 从 0 - x, 使用二分的思想啊~为了防止overflow, 把low和up用long。然后return int类型就行了~据说还有一种牛顿迭... 阅读全文
posted @ 2015-02-25 07:43 Sherry是小太阳 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to come... 阅读全文
posted @ 2015-02-25 03:52 Sherry是小太阳 阅读(274) 评论(0) 推荐(0) 编辑