llllmz

导航

上一页 1 2 3 4 5 6 ··· 35 下一页

2024年10月10日

383. 赎金信

摘要: class Solution { public: bool canConstruct(string ransomNote, string magazine) { unordered_map<char, int> unmapran; unordered_map<char, int> unmapmag; 阅读全文

posted @ 2024-10-10 22:38 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

2024年10月8日

454. 四数相加 II

摘要: class Solution { public: int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) { int ans = 0; unordered_map 阅读全文

posted @ 2024-10-08 18:36 神奇的萝卜丝 阅读(10) 评论(0) 推荐(0)

2024年10月7日

1. 两数之和

摘要: class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { unordered_map<int, int> unmap; for(int i = 0; i < nums.size(); ++i){ unma 阅读全文

posted @ 2024-10-07 21:56 神奇的萝卜丝 阅读(22) 评论(0) 推荐(0)

2024年10月6日

202. 快乐数

摘要: 预计再过半个月就可以写项目了,不知道像我这样的彩笔,能不能驾驭得住项目难度,希望可以随便拿捏。 class Solution { public: bool isHappy(int n) { unordered_set<int> unset; while(1){ int sum = getNextNu 阅读全文

posted @ 2024-10-06 20:49 神奇的萝卜丝 阅读(14) 评论(0) 推荐(0)

2024年10月5日

349. 两个数组的交集

摘要: class Solution { public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { unordered_set<int> ans_set; unordered_set<int> num1_set(nu 阅读全文

posted @ 2024-10-05 21:03 神奇的萝卜丝 阅读(14) 评论(0) 推荐(0)

2024年10月4日

242. 有效的字母异位词

摘要: class Solution { public: bool isAnagram(string s, string t) { if(s.size() != t.size()) return false; for(int i = 0; i < s.size(); ++i) ++maps[s[i]]; f 阅读全文

posted @ 2024-10-04 20:04 神奇的萝卜丝 阅读(9) 评论(0) 推荐(0)

2024年9月30日

142. 环形链表 II

摘要: class Solution { public: ListNode *detectCycle(ListNode *head) { ListNode* fast = head; ListNode* slow = head; while(fast && fast->next){ fast = fast- 阅读全文

posted @ 2024-09-30 19:46 神奇的萝卜丝 阅读(10) 评论(0) 推荐(0)

2024年9月28日

面试题 02.07. 链表相交

摘要: 明天回家喽,最近在学习的瓶颈期,感觉学的东西好难,有厌学的心理,但是我相信过了这段煎熬的时期,就好了。 class Solution { public: ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) { int na 阅读全文

posted @ 2024-09-28 21:37 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

2024年9月27日

19. 删除链表的倒数第 N 个结点 Plus

摘要: class Solution { public: ListNode* removeNthFromEnd(ListNode* head, int n) { if(!head) return head; ListNode* dummyHead = new ListNode(0, head); ListN 阅读全文

posted @ 2024-09-27 21:03 神奇的萝卜丝 阅读(8) 评论(0) 推荐(0)

19. 删除链表的倒数第 N 个结点

摘要: 相当于删除正数第n个节点 class Solution { public: ListNode* removeNthFromEnd(ListNode* head, int n) { if(!head) return head; int listLength = 0; ListNode* temp = 阅读全文

posted @ 2024-09-27 20:45 神奇的萝卜丝 阅读(15) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 35 下一页