Skip to content

Commit 34573be

Browse files
authored
Update README.md
1 parent 1687a45 commit 34573be

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

README.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
const binarySearch = require('./binarySearch')
2-
3-
const arr = new Array(100).fill(0).map(() => Math.round(Math.random() * 100)).sort((a, b) => a - b)
4-
5-
console.log(arr)
6-
const target = Math.round(Math.random() * 100)
7-
console.log('target', target)
8-
const result = binarySearch(arr, target)
9-
console.log('result', arr[result])
10-
11-
function check (result) {
12-
let index = -1
13-
for (let i of arr) {
14-
if (arr[i] === target) {
15-
index = i
16-
console.log(target, arr[i])
17-
break
18-
}
19-
}
20-
const flag = result === index
21-
return flag
22-
}
23-
24-
console.log(check(result) ? 'success' : 'fail')
251
## 前端食堂的 LeetCode 题解仓库
262

273
[![](https://img.shields.io/badge/WeChat-微信群-brightgreen)](#交流)

0 commit comments

Comments
 (0)