牛客159707358号
牛客159707358号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客159707358号的博客
TA的专栏
40篇文章
0人订阅
剑指offer回顾
40篇文章
116人学习
全部文章
(共99篇)
题解 | 合并两个排序的链表 遍历
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: /*...
2025-03-16
0
65
题解 | 反转链表 递归法
/** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { public: /*...
2025-03-16
0
47
题解 | 从尾到头打印链表 链表逆向打印
递归法 /** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : * val(x), next(NULL) { * ...
2025-03-16
0
76
题解 | 机器人的运动范围 经典递归题
class Solution { public: int dir[4][2]={{1,0},{-1,0},{0,-1},{0,1}}; //上下左右 int cal(int a) { if(a<10) { ...
2025-03-12
0
74
题解 | 剪绳子(进阶版)知道思路 但是超出范围了
class Solution { public: long long mod = 998244353; //快速乘法 long long fast(long long x, long long y){ long long res = 0; x...
2025-03-11
0
46
题解 | 复杂链表的复制 相对位置相同求random节点
/* struct RandomListNode { int label; struct RandomListNode *next, *random; RandomListNode(int x) : label(x), next(NULL), rand...
2025-03-11
0
55
题解 | 孩子们的游戏(圆圈中最后剩下的数) 可以看成第m-1人出局的问题,求新旧编号
class Solution { public: int function(int n, int m) { if (n == 1) return 0; //递归 int x = function(n - 1, m);...
2025-03-09
0
86
题解 | 数组中的逆序对
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型vector * @return int整型 ...
2025-03-09
0
85
题解 | 二叉搜索树与双向链表 中序遍历就是顺序
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class ...
2025-03-07
0
55
题解 | 数据流中的中位数 快排n*logn
class Solution { public: vector<int> v; void Insert(int num) { //快排nlogn v.push_back(num); sort(v.begin(),v.end()); } ...
2025-03-07
0
72
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页