牛客159707358号
牛客159707358号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客159707358号的博客
TA的专栏
40篇文章
0人订阅
剑指offer回顾
40篇文章
116人学习
全部文章
(共99篇)
题解 | 数组中只出现一次的两个数字 位运算方法
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型vector * @return int整型vector...
2025-03-01
0
61
题解 | 数组中只出现一次的两个数字 有序哈希
#include <unordered_map> class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型vec...
2025-03-01
0
48
题解 | 二叉搜索树的后序遍历序列 搜索二叉树中序相当当于后序的升序排序;树,中序后序等于进出栈序
class Solution { public: bool check(vector<int>& inpush,vector<int>& outpop) { int n=inpush.size(); stack&...
2025-03-01
0
45
题解 | 二叉搜索树的后序遍历序列 分治
class Solution { public: bool check(vector<int>& sequence,int l,int r) { if(l>r) { return true; ...
2025-03-01
0
50
题解 | 二叉搜索树的后序遍历序列 思路 建立搜索树再后序
class Solution { struct TreeNode{ int val; TreeNode* left; TreeNode* right; TreeNode(int val):val(val),left(nullpt...
2025-03-01
0
61
题解 | 栈的压入、弹出序列
#include <cmath> class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param pushV int整型vector ...
2025-03-01
0
71
题解 | 树的子结构 由已知两棵树根节点,比较两棵树是否相同plus 版
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class ...
2025-03-01
0
64
题解 | 链表中环的入口结点 空间为O(n)
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ #include <vector> cl...
2025-03-01
0
64
题解 | 调整数组顺序使奇数位于偶数前面(一) push_back会导致迭代器失效
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param array int整型vector * @return int整型vecto...
2025-02-28
0
73
题解 | 数值的整数次方
class Solution { public: double Power(double base, int exponent) { if(exponent>0) { double sum=1; for(i...
2025-02-28
0
57
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页