Skip to content

Commit 84a8898

Browse files
committed
two-sum
1 parent cb001dc commit 84a8898

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

two-sum/sooooo-an.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function twoSum(nums: number[], target: number): number[] {
2+
for (let i = 0; i < nums.length; i++) {
3+
for (let j = i + 1; j < nums.length; j++) {
4+
if (nums[i] + nums[j] === target) {
5+
return [i, j];
6+
}
7+
}
8+
}
9+
}
10+
11+
/**
12+
* runtime: 30ms / Beats 38.67%
13+
* memory 56.56MB / Beats 63.38%
14+
*/

0 commit comments

Comments
 (0)