摘要:
Implementint sqrt(int x).Compute and return the square root ofx.求平方根, 用的是二分法. 从 0 - x, 使用二分的思想啊~为了防止overflow, 把low和up用long。然后return int类型就行了~据说还有一种牛顿迭... 阅读全文
摘要:
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... 阅读全文