牛客马MAXEY
牛客马MAXEY
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客马MAXEY的博客
TA的专栏
68篇文章
1人订阅
2024考研数据结构
68篇文章
306人学习
全部文章
(共66篇)
题解37 | fxxkMidDfs#将二叉搜索树改为累加树#
来自专栏
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2023-10-13
0
109
题解36 | BFS#二叉树的最大宽度#
来自专栏
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2023-10-12
0
144
题解35 | 子不教父之过#修剪叶子#
来自专栏
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2023-10-09
0
142
题解34 | #升序小堆#降序大堆#数据流中的中位数#
来自专栏
#include <functional> #include <queue> class Solution { private: priority_queue<int,vector<int>,less<int>> max; //大顶...
2023-10-07
0
179
题解33 | #动态规划#连续子数组的最大和#
来自专栏
1.动态规划——时间复杂度O(n),空间复杂度O(n) #include <vector> #include <algorithm> using namespace std; class Solution { public: /** * 代码中的类名、方法名...
2023-10-04
0
154
题解32 | 经典冒泡+快速+归并#排序#
来自专栏
1.冒泡排序时间复杂度为O(n^2),空间复杂度为O(1)。基本算法思想是比较相邻的两个元素,如果顺序错误就交换位置,直到整个数组有序。 #include <algorithm> #include <fstream> #include <vector> class...
2023-10-03
1
94
题解31 | #【模板】循环队列##【模拟】队列#
来自专栏
#include <iostream> using namespace std; struct queue{ int q[100000]; int head; int rear; queue(){ head = 0;rear = 0;} }; int l...
2023-09-29
0
216
题解30 | 重复可以替代的东西总会被消除#点击消除#
来自专栏
#include <iostream> #include <stack> #include <string> using namespace std; string Duplicates(const string &s) { stack<ch...
2023-09-28
0
182
题解29 | LIFO#逆波兰表达式求值#
来自专栏
#include <string> class Solution { public: int evalRPN(vector<string>& tokens) { // write code here stack <int&...
2023-09-28
0
118
题解28 | 知否知否,应是栈空字走#有效括号序列#
来自专栏
class Solution { public: bool isValid(string s) { // write code here stack<char> str; //期有佳人配才智 待到花开烂漫时 for(...
2023-09-28
0
221
首页
上一页
1
2
3
4
5
6
7
下一页
末页