1. TwoSum - Really Naive Solution

This commit is contained in:
2022-10-19 07:43:32 +01:00
parent 6b2a8bdaf3
commit 414d968417
5 changed files with 221 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#include <vector>
using namespace std;
namespace TwoSum{
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
for (int i = 0; i < nums.size(); i++)
{
for (int j = i+1; i < nums.size(); j++)
{//Loop through the dataset
if (nums[i] + nums[j] == target)
{//Check sum
{
return vector<int>(i, j);
}
}
}
}
return vector<int>();
}
};
}

5
C++/src/main.cpp Normal file
View File

@ -0,0 +1,5 @@
#include <iostream>
int main() {
}