xchen.fighter
xchen.fighter
全部文章
题解
归档
标签
去牛客网
登录
/
注册
xchen.fighter的博客
全部文章
/ 题解
(共7篇)
题解 | #树的直径#
树形DP /** * struct Interval { * int start; * int end; * }; */ class Solution { public: /** * 树的直径 * @param n int整型 树的节点个数 ...
2021-07-30
0
531
题解 | #最长重复子串#
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param a string字符串 待计算字符串 * @return int整型 */ ...
2021-07-09
0
487
题解 | #判断一棵二叉树是否为搜索二叉树和完全二叉树#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ class Solution { public: /** * ...
2021-07-06
0
542
题解 | #字典树的实现#
struct TrieNode { int cnt; bool end; TrieNode* next[26] = {nullptr}; TrieNode() { cnt = 1; end = false; for (i...
2021-07-05
3
575
题解 | #数字字符串转化成IP地址#
class Solution { public: /** * * @param s string字符串 * @return string字符串vector */ vector<string> restoreIpAddresses...
2021-07-03
0
587
O(n)解决方案
class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { int sum = 0; int maxVal = INT_MIN; int maxNeg ...
2020-04-16
0
525
二叉树变双向链表
使用递归,分四种情况讨论即可 /* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left...
2020-04-11
0
533