mirror of
https://github.com/mudabbir-ahmad/Leet-Code-prog.git
synced 2026-10-07 18:30:20 +00:00
22 lines
411 B
C++
22 lines
411 B
C++
//
|
|
// Created by bob on 12/04/2026.
|
|
//
|
|
|
|
#include "TwoSum.h"
|
|
|
|
// Solution ::
|
|
|
|
class Solution {
|
|
public:
|
|
vector<int> twoSum(vector<int>& nums, int target) {
|
|
for (int j = 0; j < nums.size(); j++)
|
|
{
|
|
for (int i = 1; i < nums.size(); i++)
|
|
{
|
|
if (nums[j]+nums[i] == target)
|
|
{ return {i, j}; }
|
|
}
|
|
}
|
|
return {};
|
|
}
|
|
}; |