城城城<
城城城<
全部文章
分类
归档
标签
去牛客网
登录
/
注册
城城城<的博客
全部文章
(共74篇)
题解 | #在二叉树中找到两个节点的最近公共祖先#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ class Solution { public: /** * * @...
2023-05-17
0
173
题解 | #二叉树中和为某一值的路径(三)#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2023-05-17
0
201
题解 | #不用加减乘除做加法#
class Solution { public: int Add(int num1, int num2) { while(num2!=0){ int t1,t2; t1=num1^num2; t2=num...
2023-05-17
0
194
题解 | #二叉搜索树的最近公共祖先#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
2023-05-17
0
216
题解 | #数字在升序数组中出现的次数#
class Solution { public: int GetNumberOfK(vector<int> data ,int k) { int t=0; if(data.size()==0){ return 0; ...
2023-05-16
0
183
题解 | #构建乘积数组#
#include <vector> class Solution { public: vector<int> multiply(const vector<int>& A) { vector<int> B; for...
2023-05-16
0
190
题解 | #跳台阶#
class Solution { public: int jumpFloor(int number) { int a=0,b=1,c=2; for(int i=0;i<number;i++){ a=b; b...
2023-05-16
0
187
题解 | #二叉树的深度#
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class ...
2023-05-16
0
177
题解 | #买卖股票的最好时机(一)#
class Solution { public: /** * * @param prices int整型vector * @return int整型 */ int maxProfit(vector<int>& prices) {...
2023-05-16
0
182
题解 | #和为S的两个数字#
#include <vector> class Solution { public: vector<int> FindNumbersWithSum(vector<int> array,int sum) { if(array.size()&l...
2023-05-16
0
173
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页