Skip to content

Commit fd85f70

Browse files
author
Heeseung Koo
committed
w01: 1. Two Sum
1 parent c4839cd commit fd85f70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

two-sum/nrudev.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function twoSum(nums: number[], target: number): number[] {
2+
const result: number[] = [];
3+
4+
for (let i = 0; i < nums.length; i++) {
5+
for (let j = i + 1; j < nums.length; j++) {
6+
if (nums[i] + nums[j] === target) {
7+
result.push(i, j);
8+
}
9+
}
10+
}
11+
12+
return result;
13+
}

0 commit comments

Comments
 (0)