二分查找
明明77
这个作者很懒,什么都没留下…
展开
-
[Leetcode]69.Sqrt(x)
[leetcode] 69. Sqrt(x)题目链接:https://leetcode.com/problems/sqrtx/Implement int sqrt(int x).Compute and return the square root of x.思路二分查找,每次看中间的数平方是不是和当前数相等.class Solution {public: int mySqrt(int x)转载 2017-12-25 18:43:35 · 173 阅读 · 0 评论 -
[leetcode] 35. Search Insert Position
题目链接:https://leetcode.com/problems/search-insert-position/Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserte转载 2017-12-18 09:40:26 · 128 阅读 · 0 评论