摘要:
Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: 阅读全文
摘要:
有个N叉树是个大食堂的地图。节点有的是餐馆,有的不是,在输入里面用boolean表示了。每个父节点到子节点的距离都是一。你作为一个吃货,从根节点出发,要去所有的餐馆尝尝,需要的最短路径是多少。楼主DFS返回两个量,一个是这个节点为根的树要吃完需要的走多长的路,另一个是一个flag表示这个子树里面有没 阅读全文
摘要:
Given a binary tree rooted at root, the depth of each node is the shortest distance to the root. A node is deepest if it has the largest depth possibl 阅读全文
摘要:
Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example: Input: 阅读全文