ZackHuang
ZackHuang
全部文章
分类
题解(6)
归档
标签
去牛客网
登录
/
注册
ZackHuang的博客
全部文章
(共6篇)
N次里面找1次的通用解法,N为偶数直接异或
class Solution { public: int singleNumber(int* A, int n) { if (!A || n == 0) return 0; int result = 0; int N = 3; ...
2020-08-20
4
904
c++动态规划加递归参考题解
class Solution { public: vector<string> wordBreak(string s, unordered_set<string>& dict) { vector<string> result; ...
2020-08-20
0
680
C++标准归并排序,极致内存操作保证空间复杂度O(1)
class Solution { public: ListNode* slow = nullptr, * fast = nullptr, * head = nullptr, * cur=nullptr; ListNode* sortList(ListNode* head) { ...
2020-08-14
1
945
c++中序遍历,点到为止
class Solution { public: TreeNode* KthNode(TreeNode* pRoot, int k) { if (!pRoot || k==0) return nullptr; array.clear(); ...
2020-08-14
0
605
c++先序遍历实现
class Solution { public: char* Serialize(TreeNode* root) { tree.clear(); PreTrav(tree, root); return const_cast<char*&g...
2020-08-14
0
657
c++双栈实现,时间复杂度O(n)
class Solution { public: vector<vector<int> > Print(TreeNode* pRoot) { vector<vector<int> > result; if(!pR...
2020-08-13
0
846