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 0e4450d commit 35d3081Copy full SHA for 35d3081
βhouse-robber/dev_qorh.tsβ βhouse-robber/Baekwangho.tsβhouse-robber/dev_qorh.ts renamed to house-robber/Baekwangho.ts
βtwo-sum/dev_qorh.tsβ βtwo-sum/Baekwangho.tsβtwo-sum/dev_qorh.ts renamed to two-sum/Baekwangho.ts
@@ -2,15 +2,9 @@
2
* κ°μ₯ λ¨μν O(n^2) λ‘ νμ΄νμμ΅λλ€
3
*/
4
function twoSum(nums: number[], target: number): number[] {
5
- let temp_i = 0;
6
- let temp_j = 0;
7
-
8
for (let i = 0; i < nums.length; i++) {
9
- temp_i = nums[i];
10
for (let j = i + 1; j < nums.length; j++) {
11
- temp_j = nums[j];
12
13
- if (temp_i + temp_j === target) {
+ if (nums[i] + nums[j] === target) {
14
return [i, j];
15
}
16
0 commit comments