We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1687a45 commit 34573beCopy full SHA for 34573be
README.md
@@ -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')
25
## 前端食堂的 LeetCode 题解仓库
26
27
[](#交流)
0 commit comments