码迷,mamicode.com
首页 >  
搜索关键字:zigzag    ( 480个结果
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 ...
分类:其他好文   时间:2017-06-18 23:40:34    阅读次数:295
[LeetCode] 103. Binary Tree Zigzag Level Order Traversal Java
题目: 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-06-15 14:17:51    阅读次数:188
leetcode | ZigZag Conversion
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 patt ...
分类:其他好文   时间:2017-06-13 14:17:07    阅读次数:155
LeetCode 06 ZigZag Conversion
https://leetcode.com/problems/zigzag-conversion/ 水题纯考细心 题目:依照Z字形来把一个字符串写成矩阵,然后逐行输出矩阵。 O(n)能够处理掉 记i为行数 第0行和第numRow-1行。 ans += str[i+k*(numRows*2-2)], k ...
分类:其他好文   时间:2017-06-12 23:55:14    阅读次数:195
Leetcode:ZigZag Conversion
问题的大意就是将字符串中的字符按锯齿状(倒N形)垂直由上向下放置,最后水平从左向右读取。比如 ABCDEFGHIJKLMN,4表示 A G M B F H L N C E I K D J 按水平顺序读取的结果则为AGMBFHLNCEIKDJ。(原题目的描述就很有问题) 解决方案非常简单,可以发现字符 ...
分类:其他好文   时间:2017-06-09 22:40:01    阅读次数:139
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 ...
分类:其他好文   时间:2017-06-06 10:34:48    阅读次数:252
LeetCode 006 ZigZag Conversion - Java
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-06-04 00:21:55    阅读次数:195
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 a ...
分类:其他好文   时间:2017-05-25 13:36:46    阅读次数:154
6. ZigZag Conversion
一、Description: 二、Solutions: 1、思路: 首先想到按照行来进行添加字符。发现第一行与最后一行位移量为 (numRows-1) * 2; 中间行的第奇数个字符的位移量为上面部分 ,即 step = (numRows-1-j) * 2, 第偶数个字符的位移量为下面部分, 即 2 ...
分类:其他好文   时间:2017-05-25 11:56:22    阅读次数:154
LeetCode ---6.ZigZag Conversion
1 public String convert(String s, int numRows) { 2 if(numRows == 1) return s; 3 StringBuilder str = new StringBuilder(""); 4 char[] ch = s.toCharArray... ...
分类:其他好文   时间:2017-05-15 22:24:55    阅读次数:182
480条   上一页 1 ... 10 11 12 13 14 ... 48 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!