牛客768685351号
牛客768685351号
全部文章
分类
题解(160)
归档
标签
去牛客网
登录
/
注册
牛客768685351号的博客
全部文章
(共163篇)
题解 | #二叉树的前序遍历#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
C++
2022-03-07
0
319
题解 | #二叉搜索树的最近公共祖先#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {...
C++
2022-03-07
0
270
题解 | #分糖果问题#
参考:https://blog.nowcoder.net/n/6356dfe5f59e4442a2a6033858d736c8 好妙 class Solution { public: /** * pick candy * @param arr int整型vector th...
C++
2022-03-06
0
309
题解 | #丑数#
参考:https://blog.nowcoder.net/n/737d5e8a1f5947eba9446b65ee5f8e84 是真的666 class Solution { public: int GetUglyNumber_Solution(int index) { if...
C++
2022-03-06
0
287
题解 | #和为K的连续子数组#
class Solution { public: /** * max length of the subarray sum = k * @param arr int整型vector the array * @param k int整型 target *...
C++
2022-03-06
0
382
题解 | #完全二叉树结点数#
/** struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(...
C++
2022-03-06
0
298
题解 | #最长重复子串#
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param a string字符串 待计算字符串 * @return int整型 */ ...
C++
2022-03-05
0
316
题解 | #第一个只出现一次的字符#
哈希表 class Solution { public: int FirstNotRepeatingChar(string str) { unordered_map<char, int> rec; for(int i=0; i<str.len...
C++
2022-03-05
0
322
题解 | #孩子们的游戏(圆圈中最后剩下的数)#
class Solution { public: int LastRemaining_Solution(int n, int m) { int res = 1; for(int i=1; i<=n; i++){ ...
C++
2022-03-05
0
284
题解 | #旋转数组的最小数字#
采用二分法, 首先判断中心点是在左边的上升区域,还是在右边的上升区域,以此来更新左右指针。 class Solution { public: int minNumberInRotateArray(vector<int> rotateArray) { int lef...
C++
2022-03-05
0
301
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页