随笔分类 - 剑指Offer
摘要:https://www.nowcoder.com/practice/57d85990ba5b440ab888fc72b0751bf8?tpId=13&tqId=33257&tab=answerKey&from=cyc_github class Solution { public: int cutRo
阅读全文
摘要:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ //注意是二叉搜索树 class Solution { public: TreeNode* ans; void dfs(TreeNode*
阅读全文
摘要:https://www.nowcoder.com/practice/947f6eb80d944a84850b0538bf0ec3a5?tpId=13&tqId=11179&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:https://www.nowcoder.com/practice/b736e784e3e34731af99065031301bca?tpId=13&tqId=11177&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:https://www.nowcoder.com/practice/a861533d45854474ac791d90e447bafd?tpId=13&tqId=11176&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:https://www.nowcoder.com/practice/91b69814117f4e8097390d107d2efbe0?tpId=13&tqId=11212&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:https://www.nowcoder.com/practice/445c44d982d04483b04a54f298796288?tpId=13&tqId=11213&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:https://www.nowcoder.com/practice/7fe2212963db4790b57431d9ed259701?tpId=13&tqId=11175&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:https://www.nowcoder.com/practice/ff05d44dfdb04e1d83bdbdab320efbcb?tpId=13&tqId=11211&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:class Solution { public: bool check(TreeNode* pRoot1, TreeNode* pRoot2){ if(pRoot2 == nullptr){ return true; } if(pRoot1 == nullptr){ return false; }
阅读全文
摘要:/* struct TreeLinkNode { int val; struct TreeLinkNode *left; struct TreeLinkNode *right; struct TreeLinkNode *next; TreeLinkNode(int x) :val(x), left(
阅读全文
摘要:class Solution { public: TreeNode* f(vector<int>& pre, int pleft, int pright, vector<int>& vin, int vleft, int vright){ if(pleft>pright) return nullpt
阅读全文
摘要:/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/class Solution { public: ListNode* FindFirstCommonNo
阅读全文
摘要:/* struct RandomListNode { int label; struct RandomListNode *next, *random; RandomListNode(int x) : label(x), next(NULL), random(NULL) { } }; */ class
阅读全文
摘要:https://www.nowcoder.com/practice/253d2c59ec3e4bc68da16833f79a38e4?tpId=13&tqId=11208&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ class Solution { public: ListNode* deleteDuplicati
阅读全文
摘要:https://www.nowcoder.com/practice/94a4d381a68b47b7a8bed86f2975db46?tpId=13&tqId=11204&tPage=1&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-int
阅读全文
摘要:vector<pair<int, double>> dicesSum(int n) { // Write your code here vector<vector<double>> dp; dp.resize(n+1); int cnt = 1; for(auto& r: dp){ r.resize
阅读全文