6. 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 pat ...
分类:
编程语言 时间:
2017-05-10 18:47:49
阅读次数:
198
题目: 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 ...
分类:
编程语言 时间:
2017-04-14 14:36:17
阅读次数:
166
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 patte ...
分类:
其他好文 时间:
2017-04-01 17:50:35
阅读次数:
229
【SinGuLaRiTy-1008】 Copyright (c) SinGuLaRiTy 2017. All Rights Reserved. 二叉查找树 二叉查找树是指具有下列性质的非空二叉树: ⑴若根结点的左子树不空,则左子树的所有结点值均小于根结点值; ⑵若根结点的右子树不空,则右子树的所有结 ...
分类:
其他好文 时间:
2017-03-22 20:40:12
阅读次数:
205
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 ...
分类:
其他好文 时间:
2017-03-09 13:23:38
阅读次数:
204
Given two 1d vectors, implement an iterator to return their elements alternately. For example, given two 1d vectors: By calling next repeatedly until ...
分类:
其他好文 时间:
2017-02-19 18:10:12
阅读次数:
181
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 ...
分类:
其他好文 时间:
2017-02-12 17:11:32
阅读次数:
198
【解析】 第一次看到这个题目的人,可能不知道ZigZag是什么意思,简单解释一下,就是把字符串原顺序012345……按下图所示排列: 发现所有行的重复周期都是 2 * nRows - 2 对于首行和末行之间的行,还会额外重复一次,重复的这一次距离本周期起始字符的距离是 2 * nRows - 2 - ...
分类:
其他好文 时间:
2017-02-04 12:20:24
阅读次数:
204
For instance, give row = 4, col = 5, print matrix in zigzag order like: [1, 8, 9, 16, 17] [2, 7, 10, 15, 18] [3, 6, 11, 14, 19] [4, 5, 12, 13, 20] 1 p... ...
分类:
其他好文 时间:
2017-02-01 10:32:45
阅读次数:
161
class Solution { public: string convert(string s, int nRows) { if (nRows <= 1) return s; string res = ""; int size = 2 * nRows - 2; for (int i = 0; i ...
分类:
其他好文 时间:
2017-01-29 20:40:13
阅读次数:
191