# leetcode-note **Repository Path**: lhalzy/leetcode-note ## Basic Information - **Project Name**: leetcode-note - **Description**: 力扣刷题笔记 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-02 - **Last Updated**: 2025-06-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # leetcode-note ## 1.两数之和 ```c++ #include #include #include using namespace std; class Solution { public: vector twoSum(vector& nums, int target) { std::map dict; std::vector result; for(int i = 0;i::iterator it = dict.find(target-nums[i]); if(it!=dict.end()){ result.push_back(it->second); result.push_back(i); break; }else{ dict[nums[i]] = i; } } return result; } }; int main() { vector nums({3,2,4}); int target = 6; Solution solution; std::vector result = solution.twoSum(nums,target); for(int i = 0;i