和前面有一题是一样的做法吧。A^1+A^2+A^3+A^4 = A^1+A^2+A^2*(A^1+A^2)类似这样搞就可以二分处理了。#include #include #include #include #include #include #include #include #include #i...
分类:
其他好文 时间:
2014-10-24 20:30:39
阅读次数:
152
Spiral Matrix IIGiven an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should retu...
分类:
其他好文 时间:
2014-10-24 12:35:31
阅读次数:
259
今天看到CSDN博客的勋章换了图表,同时也增加显示了博客等级,看起来都听清新的,感觉不错!
【题目】
Given a m x n matrix, 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 yo...
分类:
其他好文 时间:
2014-10-24 11:01:34
阅读次数:
219
POJ 3233 - Matrix Power Series ( 矩阵快速幂 + 二分)#include #include #include using namespace std;typedef long long LL;#define MAX_SIZE 30#define CLR( a, b )...
分类:
其他好文 时间:
2014-10-24 00:01:33
阅读次数:
408
Spiral MatrixGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following m...
分类:
其他好文 时间:
2014-10-23 19:03:17
阅读次数:
272
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?
class Solution {
public:
void rotate(std::vector >...
分类:
其他好文 时间:
2014-10-23 12:37:18
阅读次数:
187
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,
Given the following matrix:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
You...
分类:
其他好文 时间:
2014-10-23 12:36:01
阅读次数:
176
Given an integer n, generate a square matrix filled with elements from 1 to n2 in
spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[...
分类:
其他好文 时间:
2014-10-23 12:31:39
阅读次数:
132
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,
Given the following matrix:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
...
分类:
其他好文 时间:
2014-10-23 00:11:12
阅读次数:
157
将图片旋转90°,实际上就是在操作数组,感觉实际中canvas可以用到。public class Solution { public void rotate(int[][] matrix) { if (matrix.length == 1) { return...
分类:
其他好文 时间:
2014-10-22 23:30:46
阅读次数:
229