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
1. Matrix.java package net.wuhx.main;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Matrix {
private String rowText = "";
priva...
分类:
编程语言 时间:
2014-10-22 18:36:53
阅读次数:
174
FZU 1911 Construct a Matrix ( 矩阵快速幂 + 构造 )题意:需要构造一个矩阵满足如下要求:1.矩阵是一个S(N)*S(N)的方阵2.S(N)代表斐波那契数列的前N项和模上M3.矩阵只能由1, 0, -1组成4.矩阵每行每列的和不能相等Here, the Fibonacc...
分类:
其他好文 时间:
2014-10-22 06:16:38
阅读次数:
313
HDU 5015 233 Matrix ( 矩阵快速幂 )这是西安网络赛的一题,,但是YY之还是没有搞出来。。后来学习了,今天写个题解吧题意:给定一个矩阵的第一列,然后需要推算出第n行第m列的数值分析:矩阵快速幂搞之构造矩阵如下(需要再增加233 和 3 两行进行状态转移)1 0 0 0 0 0 0...
分类:
其他好文 时间:
2014-10-22 06:14:34
阅读次数:
240
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.题意:在一个只有0、1的矩阵中找到一个面积最大的矩形,它内部所有的...
分类:
其他好文 时间:
2014-10-21 11:46:41
阅读次数:
129
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5015
题目大意:给你一个n*m(n
解题思路:由于n较小,所以我们可以一列一列的推,即矩阵递推如下:
/**
本题是一个n * m的矩阵(m比较大)
a[0][1]=233 a[0][2]=2333 ...
a[1][0] a[1][1]...
分类:
其他好文 时间:
2014-10-21 10:26:49
阅读次数:
203
1 public class Q1_7{ 2 3 public static void SetZero(int[][] matrix){ 4 5 boolean [] row= new boolean[matrix. length]; 6 7 boolean[] column =new ...
分类:
其他好文 时间:
2014-10-20 21:09:58
阅读次数:
226
Matrix Decompressing
题目:
给出一个矩阵的前i行,前j列的和。要求你求出满足的矩阵。矩阵的数范围在[1,20]。
一开始就坑在了这里。没读仔细题目。囧。。。
其实这题的模型就是一个网络流的行列模型,跟poj的那题budge一样建图。不过Poj 的那个建图输入麻烦,而这题是裸的,因为已经告诉你了下界为1,上界为20,囧。。。而且poj那题我至今也不知...
分类:
其他好文 时间:
2014-10-20 15:10:36
阅读次数:
200