diff --git a/two_sum.cpp b/two_sum.cpp index ac6a162..bb875e6 100644 --- a/two_sum.cpp +++ b/two_sum.cpp @@ -7,7 +7,7 @@ vector twoSum(vector& nums, int target) { int n = nums.size(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { - if (/* TODO */) { + if (i != j && target == nums[i] + nums[j]) { // found pair return {i, j}; }