问题描述:
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given ...
分类:
其他好文 时间:
2015-01-13 19:49:51
阅读次数:
152
The problem:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next ...
分类:
其他好文 时间:
2015-01-12 01:34:47
阅读次数:
189
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary ...
分类:
其他好文 时间:
2015-01-10 18:17:08
阅读次数:
177
Binary Tree Zigzag Level Order TraversalGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then...
分类:
其他好文 时间:
2015-01-10 16:35:50
阅读次数:
155
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 font for better legibility)
P A H N
A P L S I ...
分类:
其他好文 时间:
2015-01-08 09:43:54
阅读次数:
174
题目链接:
找规律的一道题,row往前进2步的话,如果投影在zigzag的路径上,则是走了一个V字形,也就是说每一行的相邻2步,都是走了同样的投影距离。然后主要抓到步数计算的规律即可。
*注意step为0的情况,这时候要pick up最大的步长继续走。
*注意row为1行的情况,最早判断,避免死循环,因为步长是0。
*一直尝试po讲解照片,但是无论如何都显示不出来。有空搞定了传张照...
分类:
其他好文 时间:
2015-01-07 18:55:23
阅读次数:
133
https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/http://blog.csdn.net/linhuanmars/article/details/24509105/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publi..
分类:
其他好文 时间:
2015-01-06 12:07:28
阅读次数:
147
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 font for better legibility)
P A H N
A P L S I ...
分类:
其他好文 时间:
2015-01-05 20:33:48
阅读次数:
206
1 class Solution { 2 public: 3 string convert(string s, int nRows) { 4 string a=""; 5 int len=s.length(); 6 if(lennRows && r...
分类:
其他好文 时间:
2015-01-03 23:48:25
阅读次数:
309
https://oj.leetcode.com/problems/zigzag-conversion/http://fisherlei.blogspot.com/2013/01/leetcode-zigzag-conversion.htmlpublicclassSolution{
publicStringconvert(Strings,intnRows){
//SolutionA:
returnconvert_NoNewMatrix(s,nRows);
}
////////////////////////..
分类:
其他好文 时间:
2015-01-02 16:13:47
阅读次数:
140