You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
思路1:直接开辟一个数组,然后按照对应关系复制即可,空间和时间复杂度o(N*N)
代码1:
...
分类:
其他好文 时间:
2015-04-06 14:16:43
阅读次数:
124
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2015-04-06 00:54:29
阅读次数:
189
/*
在终端输入多行,找出有“ould”的行,并打印,如:love could you and I with fate conspireTo grasp this sorry scheme of things entire,
Would not we shatter it to bitd - and then.
则输出:
Au,love could you and I with fate cons...
分类:
编程语言 时间:
2015-04-05 21:59:55
阅读次数:
180
Given an array of integers, every element appears three times except for one. Find that single one.Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using ex...
分类:
其他好文 时间:
2015-04-05 14:42:18
阅读次数:
138
SG Value
Time Limit: 5 Sec Memory Limit:
256 MB
Submit: 163 Solved: 45
[Submit][Status][Web
Board]
Description
The SG value of a set (multiset) is the minimum positive integer that could no...
分类:
其他好文 时间:
2015-04-05 09:09:01
阅读次数:
119
D - Mayor's posters
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Practice POJ 2528
Description
The citizens of Bytetown, AB, could not stand that the candid...
分类:
其他好文 时间:
2015-04-04 18:32:53
阅读次数:
320
/* 在终端输入多行信息,找出包含"ould"的行,并打印改行。
如:
Au,love could you and I with fate conspire
To grasp this sorry scheme of things entire,
Would not we shatter it to bitd - and then.
在终端输出上述的文字,输出
Au,love could you ...
分类:
编程语言 时间:
2015-04-04 13:44:11
阅读次数:
172
??
问题描述:
Determine whether an integer is a palindrome. Do thiswithout extra space.
click to showspoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If yo...
分类:
其他好文 时间:
2015-04-04 09:18:33
阅读次数:
137
Question:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2...
分类:
其他好文 时间:
2015-04-04 01:08:13
阅读次数:
190
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?题解:如果要原地算法的话,就只能用交换...
分类:
其他好文 时间:
2015-04-03 16:52:32
阅读次数:
129