Update js code and docs

This commit is contained in:
gyt95
2022-12-16 16:27:13 +08:00
parent c8da48c0d6
commit dc985cb962
2 changed files with 13 additions and 8 deletions

View File

@ -91,7 +91,7 @@ comments: true
```js title="leetcode_two_sum.js"
function twoSumBruteForce(nums, target) {
let n = nums.length;
const n = nums.length;
// 两层循环,时间复杂度 O(n^2)
for (let i = 0; i < n; i++) {
for (let j = i + 1; j < n; j++) {
@ -100,6 +100,7 @@ comments: true
}
}
}
return [];
}
```
@ -214,6 +215,7 @@ comments: true
m[target - nums[i]] = i;
}
}
return [];
}
```