摘要:
参考:https://zhuanlan.zhihu.com/p/31498036 https://www.jianshu.com/p/83bb10ad1d32 阅读全文
摘要:
1 vector<int> getLeastNumber(vector<int>& arr,int k){ 2 vector<int> vec(k,0); 3 if(0==k) 4 return vec; 5 priority_queue<int> q; 6 for(int i = 0;i < k; 阅读全文
摘要:
1 Node* pre = NULL,*cur = BULL; 2 Node* treeToDoubleyList(Node* root){//二叉搜索树中序遍历有序 3 if(root == NULL) 4 return NULL; 5 Node* dummy = new Node; 6 dumm 阅读全文
摘要:
1 vector<vector<int>> pathSum(TreeNode* root,int sum){//DFS遍历获取适合路径,当递归到叶子结点且sum为0,表示该路径合适 2 vector<vector<int>> ans; 3 vector<int> path; 4 5 helper(r 阅读全文
摘要:
1 string serialize(TreeNode* root) {//层序便利,将空的子节点也放入到字符串 2 ostringstream out; 3 queue<TreeNode*> q; 4 q.push(root); 5 while(q.size()){ 6 auto node = q 阅读全文