key points:1 conversion between different types2 overflow 会有比较多corner cases需要考虑3 iterationrelated questions:Median of Two Sorted ArraysReverse Integer...
分类:
其他好文 时间:
2015-06-23 06:15:12
阅读次数:
150
#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 pattern in a fixed font for better legibility)...
分类:
其他好文 时间:
2015-06-22 22:25:11
阅读次数:
181
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-06-22 11:11:22
阅读次数:
99
android 项目在eclipse 出现Unable to execute dex: Multiple dex files define Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files de...
分类:
移动开发 时间:
2015-06-21 19:45:33
阅读次数:
168
原题链接:https://leetcode.com/problems/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 i...
分类:
其他好文 时间:
2015-06-21 14:28:48
阅读次数:
153
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
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
解题思路:
因为行数为变量,因此我们需要找到每一行的规律。例如:当行数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矩阵,参考了下http://blog.163.com/yangjun1988422@126/blog/static/4741291720117842634276/,具体思路和程序在下面。
// test2.cpp : 定义控制台应用程序的入口点。
//Date:2015年6月17日
//Author: jsalienzy
/* ...
分类:
编程语言 时间:
2015-06-18 11:29:23
阅读次数:
194
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