Binary Tree Zigzag Level Order TraversalTotal Accepted:49079Total Submissions:179977Difficulty:MediumGiven a binary tree, return thezigzag level order...
分类:
其他好文 时间:
2015-12-18 10:26:59
阅读次数:
125
题目链接: http://www.lintcode.com/zh-cn/problem/binary-tree-zigzag-level-order-traversal/二叉树的锯齿形层次遍历 给出一棵二叉树,返回其节点值的锯齿形层次遍历(先从左往右,下一层再从右往左,层与层之间交替进行)样例 .....
分类:
其他好文 时间:
2015-12-13 02:10:17
阅读次数:
151
题目:Given two 1d vectors, implement an iterator to return their elements alternately.For example, given two 1d vectors:v1 = [1, 2]v2 = [3, 4, 5, 6]By c...
分类:
其他好文 时间:
2015-12-10 13:32:40
阅读次数:
217
Matrix Zigzag TraversalGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in ZigZag-order.Have you met this question in ...
分类:
其他好文 时间:
2015-12-06 21:04:11
阅读次数:
621
1 public class Solution { 2 public List> zigzagLevelOrder(TreeNode root) { 3 List> result = new ArrayList>(); 4 if (root == null)...
分类:
其他好文 时间:
2015-12-04 10:37:41
阅读次数:
139
public class Solution { public String convert(String s, int numRows) { if (numRows == 1) { return s; } int flg = 0;...
分类:
其他好文 时间:
2015-12-03 07:11:42
阅读次数:
128
LeetCode -- ZigZag Conversion...
分类:
其他好文 时间:
2015-12-02 10:37:09
阅读次数:
107
1 var convert = function(s, numRows) { 2 if (numRows === 1) { 3 return s; 4 } 5 6 var i, j, 7 count = 0, 8 colDi...
分类:
其他好文 时间:
2015-11-25 10:06:21
阅读次数:
155
思路:String[numRow]行字符串数组。读取原始字符串每一个字符,设置行变量 nrow和行标志位flag(向下一行为1或向上一行为-1)。将该字符连接到数组中对应的行字符串,同时nrow+=flag。 1 public String convert(String s, int num...
分类:
其他好文 时间:
2015-11-16 00:44:28
阅读次数:
144
问题描述The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed fon...
分类:
其他好文 时间:
2015-10-29 13:15:46
阅读次数:
173