Leetcode Record: Leetcode Record

87281 3 0 zip 2024-10-04 23:10:11

leetcode推前LeetCode题目记录目录二和class Solution { public: vector twoSum (vector& nums, int target) { map m; int l = nums.size(); vector ret; for (int i = 0; i < l; i++) { if (m.count(nums[i])) { ret.push_back(m[nums[i]]); ret.push_back(i); return ret; } else { m[target - nums[i]] = i; } } return ret; } }; 添加两个数字 / Definition for singly-linked list. struct ListNode { int val; ListNode next; ListNode(int x) : val(x), next(NULL) {} }; */ class Solu

用户评论
请输入评论内容
评分:
暂无评论