diff --git "a/exercise/LC0001_\350\214\203\344\277\256\350\252\211.cpp" "b/exercise/LC0001_\350\214\203\344\277\256\350\252\211.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..4a61bd0c3ff88d172ce29c9a85e34857c1714657 --- /dev/null +++ "b/exercise/LC0001_\350\214\203\344\277\256\350\252\211.cpp" @@ -0,0 +1,17 @@ +class Solution { +public: + vector twoSum(vector& nums, int target) { + int n = nums.size(); + for (int i = 0; i < n; ++i) + { + for (int j = i + 1; j < n; ++j) + { + if (nums[i] + nums[j] == target) + { + return {i, j}; + } + } + } + return {}; + } +};