Skip to content

Commit 265c829

Browse files
meteorqz6claude
andcommitted
two sum solution
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ae74b75 commit 265c829

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎two-sum/meteorqz6.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// 시간 복잡도: O(n^2)
2+
// 공간 복잡도: O(1)
3+
4+
/**
5+
* @param {number[]} nums
6+
* @param {number} target
7+
* @return {number[]}
8+
*/
9+
var twoSum = function (nums, target) {
10+
for (let i = 0; i < nums.length; i++) {
11+
for (let j = i + 1; j < nums.length; j++) {
12+
if (nums[i] + nums[j] === target) {
13+
return [i, j];
14+
}
15+
}
16+
}
17+
};

0 commit comments

Comments
 (0)