JZ8
剑指offer刷题 进度:JZ8
题目列表 https://www.nowcoder.com/ta/coding-interviews JZ3 数组中重复的数字 时间空间复杂度都为$O(n)$,直接建一个数组a,初始化全0,出现数i就a[i]++ int duplicate(vector<int>& numbers) { const ......
JZ8 二叉树的下一个结点
做法一:直接求出中序遍历,并用vector容器存储。 /* struct TreeLinkNode { int val; struct TreeLinkNode *left; struct TreeLinkNode *right; struct TreeLinkNode *next; TreeLin ......