Skip to content

Instantly share code, notes, and snippets.

View dalaoque's full-sized avatar
💻
hha

John dalaoque

💻
hha
  • Beijing,China
View GitHub Profile

算法学习(javascript)

二分查找

  • 给有序数字集合插入数字num,集合规律不变。
const arr = [-10, -5, 0, 5, 7, 56, 89, 189, 888]

const insertTarget = num => {
  let [left, right, mid, target] = [0, arr.length - 1]
  
 while (left <= right) {
0xAC9caE70DE6f10E1406650b0E4a8f712399CB5a4