Skip to content

Commit

Permalink
Merge pull request #141 from shresth12-jain/master
Browse files Browse the repository at this point in the history
Added solution for Two Sum Problem in LeetCode #27
  • Loading branch information
larissalages authored Oct 9, 2020
2 parents 3effddb + 302145c commit 9700878
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 9700878

Please sign in to comment.