原题地址基本数据结构操作,二叉树的层次遍历。代码: 1 vector > zigzagLevelOrder(TreeNode *root) { 2 vector > res; 3 vector layer; 4 bool l2r = true; 5 ...
分类:
其他好文 时间:
2015-01-29 20:49:11
阅读次数:
169
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 fo...
分类:
其他好文 时间:
2015-01-28 19:41:56
阅读次数:
173
题目链接:ZigZag Conversion
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)
...
分类:
其他好文 时间:
2015-01-28 14:45:26
阅读次数:
93
标题:ZigZag Conversion通过率:22.7%难度:简单The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to displ...
分类:
其他好文 时间:
2015-01-28 14:23:47
阅读次数:
129
思路:
想了好久,思维总是局限在二维数组,找字符串的长度和二维数组的行列数之间的某种联系,想了好久,没有思路。
然后,然后就上网看了一下,有一种思路说是用字符串数组即可,就想到了StringBuilder,直接Append多好,这得比二维数组高级多少啊!然后就用StringBuilder做这道题了。...
分类:
其他好文 时间:
2015-01-28 08:27:46
阅读次数:
163
/************************************************************************/ /* 38: Binary Tree Zigzag Level Order Traversal */ /*********************.....
分类:
其他好文 时间:
2015-01-27 23:17:40
阅读次数:
150
题目: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...
分类:
其他好文 时间:
2015-01-27 18:26:07
阅读次数:
184
题目: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...
分类:
其他好文 时间:
2015-01-27 16:26:55
阅读次数:
172
ZigZag ConversionThe string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern i...
分类:
其他好文 时间:
2015-01-27 00:30:10
阅读次数:
202
这个博主找规律的部分写得很好,原样放在下面。最后给出了顺时针和逆时针方向的螺旋队列的实现,可以看出它们的差别如此之小。
和螺旋队列类似,也是找规律的zigzag数组见这个帖子。
螺旋队列的样子如下图:
两大规律:
1、螺旋规律
2、奇数(圈数,或X轴正坐标)平方规律(紫线)
问题描述:
设1的坐标是(0,0),x方向向右为正,y方向向下为正,例如,7的坐标为(...
分类:
其他好文 时间:
2015-01-26 22:55:48
阅读次数:
247