Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the same row and column, the order should be fromleft to right. Have you met this question in a real interview? Yes Example Given binary t...
Binary Tree Vertical Order Traversal https://leetcode.com/problems/binary-tree-vertical-order-traversal/ 这道题让我们竖直的遍历树,和按层遍历非常相似。我第一次做的时候,使用的是递归的形式,发现顺序会出错。 因此还是要借助按层遍历的思路,将树逐层的加入一个队列,然后再取出来进行处理。 遍历的时候,...