Skip to content

Commit

Permalink
Added solution for Two Sum Problem in LeetCode larissalages#27
Browse files Browse the repository at this point in the history
  • Loading branch information
shresth12-jain committed Oct 8, 2020
1 parent 468727c commit 302145c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions leetcode/cpp/Array/1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target)
{
vector<int> a;
for (int i=0; i<nums.size(); i++)
{
for(int j=i+1; j<nums.size(); j++)
{
if(nums[i] + nums[j]==target)
{
a= {i,j};
break;
}
}
}
return a;
}
};

0 comments on commit 302145c

Please sign in to comment.