二叉树 36. 二叉树的中序遍历 递归就不写了,写一下迭代法 class Solution(object):def inorderTraversal(self, root):""":type root: TreeNode:rtype: List[int]"""if not root:return res = []cur = rootstack = []while cur or stack:i
#include<iostream>#include<cstring>#include<string>#include<cstdio>#include<algorithm>using namespace std;#define MAX 80000int father[MAX], son[MAX];int v,v2, l;struct K
685.冗余连接II 这题需要考虑两种情况: 1.两个输入 2.没有两个输入就是有成环 class Solution{public:static const int N = 1005;int father[N];int n;void init(){for (int i = 0; i <= n; i++){father[i] = i;}}int find(int x){return x