摘要: [0344.反转字符串] class Solution { public: void reverseString(vector<char>& s) { int left = 0; int right = s.size() - 1; while (left < right) { char temp = 阅读全文
posted @ 2022-11-10 20:20 跬步瑶 阅读(33) 评论(0) 推荐(0)
摘要: [0015.三数之和] 首先 哈希法我不会用 就算看了思路和代码 还是不会 尤其是 去重那块 其次 看到可以用双指针法 那我又去想了想 想自己动手写 但还是写不出来 然后 我看了一遍双指针法的思路 代码见下: class Solution { public: vector<vector<int>> 阅读全文
posted @ 2022-11-09 17:19 跬步瑶 阅读(64) 评论(0) 推荐(0)
摘要: [0001.两数之和] 不会用 map。。。后面再看 先放着 C++代码: class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { std::unordered_map <int, int> map; 阅读全文
posted @ 2022-11-08 20:03 跬步瑶 阅读(41) 评论(0) 推荐(0)
摘要: [0349.两个数组的交集] class Solution { public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { vector<int> result (1000 , 0); int k = 0; f 阅读全文
posted @ 2022-11-08 17:02 跬步瑶 阅读(41) 评论(0) 推荐(0)
摘要: 第一次参加 我激动的心 颤抖的手 勉勉强强提交了第一题 磕磕绊绊到达并最终倒在了第二题>-< [6229. 对数组执行操作] class Solution { public: vector<int> applyOperations(vector<int>& nums) { int length = 阅读全文
posted @ 2022-11-06 21:24 跬步瑶 阅读(25) 评论(0) 推荐(0)
摘要: [1002.查找常用字符] class Solution { public: vector<string> commonChars(vector<string>& words) { int hashMap[100][26] = {0}; int count = 0; int k =0; string 阅读全文
posted @ 2022-11-06 21:04 跬步瑶 阅读(35) 评论(0) 推荐(0)
摘要: [0242.有效的字母异位词] 我完全没思路 以前只是在书上学过 哈希查找相关的 哈希函数构造方法、哈希冲突处理方法、哈希表上查找删除伪代码,没有真正用哈希方法实现代码解决问题 简而言之:知道 不会用 看了思路 我定义已知长度数组基本语句不会,26个字母映射到自己定义的长度为26的数组的方法不知道, 阅读全文
posted @ 2022-11-06 21:03 跬步瑶 阅读(38) 评论(0) 推荐(0)
摘要: [面试题02.07.链表相交] /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * 阅读全文
posted @ 2022-11-04 21:57 跬步瑶 阅读(53) 评论(0) 推荐(0)
摘要: [0019.删除链表的倒数第N个节点] /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} 阅读全文
posted @ 2022-11-03 22:01 跬步瑶 阅读(38) 评论(0) 推荐(0)
摘要: [0206.翻转链表] /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNo 阅读全文
posted @ 2022-11-02 20:04 跬步瑶 阅读(20) 评论(0) 推荐(0)