Skip to content

Commit a377f09

Browse files
committed
twoSum solution1
1 parent e1cbafe commit a377f09

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

two-sum/hyejj19.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function twoSum(nums: number[], target: number): number[] {
2+
for (let lt = 0; lt < nums.length - 1; lt++) {
3+
for (let rt = lt + 1; rt < nums.length; rt++) {
4+
if (nums[lt] + nums[rt] === target) return [lt, rt];
5+
}
6+
}
7+
return [0, 0];
8+
}

0 commit comments

Comments
 (0)