摘要: 有效的字母异位词 class Solution { public: bool isAnagram(string s, string t) { int record[26] = {0}; for(int i = 0; i < s.size(); ++i) { record[s[i] - 'a']++; 阅读全文
posted @ 2024-08-19 20:40 ikun1111 阅读(39) 评论(0) 推荐(0)
摘要: 两两交换链表中的节点 一开始有错误,找不出来,但是gdb真好用 Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} Li 阅读全文
posted @ 2024-08-19 20:31 ikun1111 阅读(39) 评论(0) 推荐(0)
摘要: 203 移除链表元素 /** Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : v 阅读全文
posted @ 2024-08-19 20:19 ikun1111 阅读(52) 评论(0) 推荐(0)
摘要: 209.长度最小的数组 使用滑动窗口,这个方法我是没有想到的 class Solution { public: int minSubArrayLen(int target, vector& nums) { int i = 0; int min = nums.size()+1; int j = 0; 阅读全文
posted @ 2024-08-19 20:09 ikun1111 阅读(46) 评论(0) 推荐(0)