You are given annxn2D matrix representing an
image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this
in-place?思路:先将矩阵转置,然后将第一列与最后...
分类:
其他好文 时间:
2014-05-14 03:09:35
阅读次数:
225
最短路+01背包
In Action
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3857 Accepted Submission(s): 1229
Problem Description
...
分类:
其他好文 时间:
2014-05-13 14:39:21
阅读次数:
175
Problem Description
Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grav...
分类:
其他好文 时间:
2014-05-13 06:58:19
阅读次数:
523
#include
//using namespace std;
class Matrix
{
public:
Matrix();
friend Matrix operator+(Matrix &,Matrix &);
friend ostream& operator
friend istream& operator>>(istream&,Matri...
分类:
其他好文 时间:
2014-05-12 22:39:15
阅读次数:
387
Spiral MatrixGiven a matrix ofmxnelements
(mrows,ncolumns), return all elements of the matrix in spiral order.For
example,Given the following matrix:[...
分类:
其他好文 时间:
2014-05-12 20:04:43
阅读次数:
268
Given an integern, generate a square matrix
filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should
return the following matri...
分类:
其他好文 时间:
2014-05-12 19:53:23
阅读次数:
332
class Solution {public: int
maximalRectangle(vector > &matrix) { int rows = matrix.size(); if (rows
== 0) return 0; int cols =...
分类:
其他好文 时间:
2014-05-12 09:54:05
阅读次数:
250
Given amxnmatrix, if an element is 0, set its
entire row and column to 0. Do it in place.click to show follow up.Follow up:Did
you use extra space?A s...
分类:
其他好文 时间:
2014-05-12 08:22:51
阅读次数:
255
这个题乍一看很简单,实际上还挺有技巧的。我最开始的想法是找一个特殊值标记,遇到一个0,把他所对应的行列中非零的元素标记成这个特殊值,0值保持不变,然后再从头遍历一次,碰到特殊值就转化成0。
问题是这个特殊值怎么确定,题目中没有把取值范围给出,我怀着侥幸的心理用了最大和最小的int,都被揪了出来。。如果找一个不存在于数组中的值,这个复杂度太高了。
有没有其他更好的方法呢?当然有。这个思想很巧妙,...
分类:
其他好文 时间:
2014-05-12 06:54:39
阅读次数:
193
C++异常:no matching function for call to
"Matrix(Matrix&)"我定义了一个类叫Matrix,其中构造函数explicit Matrix(const Matrix&
source);也写了一个方法:Matrix Matrix::myFun(const ...
分类:
编程语言 时间:
2014-05-10 07:16:04
阅读次数:
363