From 6b8c8fb58932de1d81e3a7812c2083d95002131a Mon Sep 17 00:00:00 2001 From: jianghe_47 <15199695+jianghe47@user.noreply.gitee.com> Date: Thu, 18 Sep 2025 19:40:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E5=91=A8=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...01_\350\214\203\344\277\256\350\252\211.cpp" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "exercise/LC0001_\350\214\203\344\277\256\350\252\211.cpp" 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 0000000..4a61bd0 --- /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 {}; + } +}; -- Gitee