摘要: // 双指针 var findContinuousSequence = function(target) { let res = [] let left = 1 let right = 2 while (left < right) { let sum = (left + right) * (righ 阅读全文
posted @ 2020-10-09 23:47 樱风凛 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 二分查找模板 // 标准二分查找,使用数组能找到的情况,最后left和right不一样,差1 function find(arr, num) { let l = 0, r = arr.length - 1; while (l <= r) { let mid = l + Math.floor((r - 阅读全文
posted @ 2020-10-09 03:48 樱风凛 阅读(174) 评论(0) 推荐(0) 编辑