今天开始不再摆烂
今天开始不再摆烂
全部文章
分类
题解(45)
归档
标签
去牛客网
登录
/
注册
今天开始不再摆烂的博客
全部文章
(共45篇)
题解 | #求平方根#
class Solution { public: /** * * @param x int整型 * @return int整型 */ //一定要记得 防止 越界 typedef long long LL; int mysqrt(int x) { if(!x) return 0; // write c...
C++
2022-01-23
0
302
题解 | #第一个只出现一次的字符#
class Solution { public: int FirstNotRepeatingChar(string str) { unordered_map<char, int> m; for(int i = 0; i < str.size(); i ++ ) ...
C++
2022-01-23
0
236
题解 | #删除有序链表中重复的元素-I#
/** struct ListNode { int val; struct ListNode *next; }; */ class Solution { public: /** * * @param head ListNode类 * @return ListNode类 / ListNode de...
C++
2022-01-23
0
331
题解 | #合并两个有序的数组#
class Solution { public: void merge(int A[], int m, int B[], int n) { for(int i = m, j = 0; i < m + n , j < n; i ++ , j ++ ) { A[i] = B[j]; } so...
C++
2022-01-23
0
248
题解 | #连续子数组的最大和#
//dp写法 class Solution { public: int FindGreatestSumOfSubArray(vector array) { int sz = array.size(); vector dp(sz + 1); dp[0] = max(0, array[0]); int ...
C++
2022-01-23
0
249
题解 | #连续子数组的最大和#
class Solution { public: int FindGreatestSumOfSubArray(vector array) { int res = 0; vector vec; bool flag = 1; for(int i = 0; i < array.size(); i +...
C++
2022-01-23
0
260
题解 | #对称的二叉树#
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } }; */ class Solutio...
C++
2022-01-23
0
285
题解 | #二叉树的最大深度#
/** struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; */ class Solution { public: /** * * @param root TreeNode类 * @return...
C++
2022-01-23
0
237
题解 | #将升序数组转化为平衡二叉搜索树#
/** struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; */ class Solution { public: /** * * @param num int整型vector * @retur...
C++
2022-01-23
0
311
题解 | #链表中倒数最后k个结点#
/** struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(nullptr) {} }; / class Solution { public: /* 代码中的类名、方法名、参数名已经指定...
C++
2022-01-23
0
271
首页
上一页
1
2
3
4
5
下一页
末页