码迷,mamicode.com
首页 >  
搜索关键字:zigzag    ( 480个结果
ZigZag Conversion
class Solution {public: enum { down = 0, up = 1, }; string convert(string s, int numRows) { string result; int index = 0; in...
分类:其他好文   时间:2015-06-20 11:46:31    阅读次数:124
Binary Tree Zigzag Level Order Traversal
Description: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-06-20 01:26:26    阅读次数:185
leetcode——6 ZigZag Conversion(折线行列输出问题)
解题思路: 因为行数为变量,因此我们需要找到每一行的规律。例如:当行数numRows=4时,则ZigZag应该按下列方式排列 不难看出,满数为4的列之间的步数为4,实际上,此时步的规律为:step=2*numRows-2 =2*4-2=6 0 6 12 18 1 5 7 11 13 17 19 2 4 8 10 14 16 20 3 9 15 21 接着我们看非满数的列,不难看出此类...
分类:其他好文   时间:2015-06-18 19:54:46    阅读次数:139
打印zigzag数组
今天花了不少时间来研究如何打印一个之字形zigzag矩阵,参考了下http://blog.163.com/yangjun1988422@126/blog/static/4741291720117842634276/,具体思路和程序在下面。 // test2.cpp : 定义控制台应用程序的入口点。 //Date:2015年6月17日 //Author: jsalienzy /* ...
分类:编程语言   时间:2015-06-18 11:29:23    阅读次数:194
Leetcode[103]-Binary Tree Zigzag Level Order Traversal
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 tree...
分类:其他好文   时间:2015-06-13 14:20:17    阅读次数:121
ZigZag Conversion
1. Question给定行数,将某字符串转换为zigzag形式,然后按行输出。zigzag形式如:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you...
分类:其他好文   时间:2015-06-12 23:52:02    阅读次数:245
leetcode - ZigZag Conversion
leetcode - ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display t...
分类:其他好文   时间:2015-06-12 18:55:55    阅读次数:114
Binary Tree Zigzag Level Order Traversal
跟之前的解法一模一样Binary Tree Level Order Traversal I,II 不赘述public class Solution { public ArrayList> zigzagLevelOrder(TreeNode root) { ArrayList> r...
分类:其他好文   时间:2015-06-10 06:31:24    阅读次数:94
【ZigZag Conversion】cpp
题目: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...
分类:其他好文   时间:2015-06-09 11:12:48    阅读次数:122
【leetcode】Binary Tree Zigzag Level Order Traversal
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 ...
分类:其他好文   时间:2015-06-07 00:57:39    阅读次数:112
480条   上一页 1 ... 27 28 29 30 31 ... 48 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!