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 511c793 commit 6c45680Copy full SHA for 6c45680
two-sum/minji0214.ts
@@ -0,0 +1,11 @@
1
+function twoSum(nums: number[], target: number): number[] {
2
+ let answer = []
3
+ for(let i = 0 ; i < nums.length; i ++){
4
+ let temp = target - nums[i]
5
+ if (nums.includes(temp) && temp != nums[i]) {
6
+ const index = nums.findIndex((test) => test === temp )
7
+ answer.push(index)
8
+}
9
+ }
10
+return answer
11
+};
0 commit comments