Skip to content

Commit 715724d

Browse files
committed
1
1 parent 03840f4 commit 715724d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

1.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Solution {
2+
public:
3+
vector<int> twoSum(vector<int>& nums, int target) {
4+
int a;
5+
int b;
6+
int n=nums.size();
7+
vector<int>A(2,0);
8+
9+
for(int i=0;i<n;i++)
10+
{
11+
for(int j=i+1;j<n;j++)
12+
{
13+
if(nums[i]+nums[j]==target)
14+
{
15+
A[0]=i;
16+
A[1]=j;
17+
break;
18+
}
19+
}
20+
}
21+
return A;
22+
}
23+
24+
};

0 commit comments

Comments
 (0)