置顶文章

217 1 分钟

# 介绍 欢迎光临我的博客站点,这是记录本人的学习历程而基于 GitHub 部署建立的,在这上面都是本人的学习笔记,希望阅读时能带给你帮助。 下面的博客的使用介绍 # 电脑端 # 首页介绍 继续点击上图右侧中的详细某个分类,进入到更为详细的分类目录,会显示在此类别下的文章,点击文章即可进入阅读 继续点击上图右侧的某个具体标签,会列出在此标签下的所有文章列表。如下: 在首页设置了精选分类,鼠标移到上面卡片就会翻转,显示在这个类别下的子分类或者文章。 # 手机端

精选分类

文章列表

107 1 分钟

# 79. 单词搜索 使用 for(elem : lists) 写法的 for 循环的时候,最后使用引用,像上面这种就是没有使用引用,导致 vector 每次都拷贝,耗费了大量的时间。同时可以看出使用 auto 类型推导并没有耗费多少时间。
1.6k 1 分钟

# 54. 螺旋矩阵 class Solution {public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<vector<int> > ve; int m = matrix.size(); int n = matrix[0].size(); vector<int> temp; vector<int>...
6.4k 6 分钟

# 56. 合并区间 0 <= starti <= endi <= 104 下标都比较小,考虑直接存储 class Solution {public: vector<vector<int>> merge(vector<vector<int>>& intervals) { int minIndex, maxIndex; minIndex = int(1e4 + 2), maxIndex = -1; for...
2.5k 2 分钟

class Solution {public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { vector<int> ve; priority_queue<Num> q; for (int i = 0; i <= k-2; i++) { q.push(Num(i, nums[i])); } int left = 0,...
1.8k 2 分钟

# 三数之和 https://leetcode.cn/problems/3sum/ 数组中的数字是可以重复的 直接三重循环遍历可行吗? 下面是超时暴力解法 class Solution {public: vector<vector<int>> threeSum(vector<int>& nums) { map<int, vector<size_t> > mp; map<string, bool> isExist;...
599 1 分钟

struct Node{ ListNode* l; bool operator < (const Node& n) const { return l->val > n.l->val; } // 这里有两种写法 // friend bool operator < ( Node a, Node b) { // return a.l->val > b.l->val; // }};class Solution...
772 1 分钟

# 二叉树的中序遍历 https://leetcode.cn/problems/binary-tree-inorder-traversal/ class Solution { public: vector<int> inorderTraversal(TreeNode* root) { vector<int> res; if (root == nullptr) return res; stack<TreeNode*> sk; TreeNode* temp = root; while (temp)...
296 1 分钟

信源编码是类似于将声音信息转为二进制串的过程。 上面的元素中就使用了 0 和...