数组相关
二分查找
对应leetcode题目
https://leetcode-cn.com/problems/binary-search/
思路
将有序排列的不重复的数组从中间分开,每次和要找的值在中点比较,如果值小于中点,则上修改有边界,否则修改左边界.
1 | function search(nums: number[], target: number): number { |
like sing ,dance,rap & 🏀
https://leetcode-cn.com/problems/binary-search/
将有序排列的不重复的数组从中间分开,每次和要找的值在中点比较,如果值小于中点,则上修改有边界,否则修改左边界.
1 | function search(nums: number[], target: number): number { |
微信支付