Duang Duang~
今天学习一下原理:Matrix:
其中e,j,o,t为偏移量aR+bG+cB+dA+e
fR+gG+hB+iA+j
kR+lG+mB+nA+o
pR+qG+rB+sA+t=R1
G1
B1
A1在onCreate函数中用post来获取组件的宽高: mGroup.post(new Runnable() {
@Override...
分类:
移动开发 时间:
2015-04-07 09:55:01
阅读次数:
181
一:Spiral Matrix I
题目:
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...
分类:
其他好文 时间:
2015-04-06 21:55:35
阅读次数:
151
//这题和之前的2870题意相似,不过多了可以任意交换两列的功能
//先开始没看见能交换两列。。。结果裸的样例都没过,最后想了想//任意交换两列,那我们就可以直接对第i行第j列得到的cnt[i][j]
//这一行惊醒排序就可以了,其中cnt[i][j]表示前i行第j列有多少
//个相同的1,进行降序排序得到a[j],那么a[j]*j的最大值就是我
//们所要的答案,因为j前面的肯定是高于j的。
...
分类:
移动开发 时间:
2015-04-06 20:20:30
阅读次数:
155
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
in place,主要是感觉比较麻烦,其实就是利用第一行和第一列保存该行列是否需要变0,再用两个变量表示第一行和第一列是否需要变0
代码:
public class Solution {
publi...
分类:
其他好文 时间:
2015-04-06 15:43:04
阅读次数:
109
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
Matrix
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2610 Accepted Submission(s): 977
Problem Description
Machines have once a...
分类:
其他好文 时间:
2015-04-06 08:52:56
阅读次数:
215
矩阵的转置数学定义:把矩阵A的行换成同序数的列得到的一个新矩阵,叫做A的转置矩阵. Public Function Trans(Optional ByVal tMatrix As Matrix = Nothing) If tMatrix Is Nothing Then ...
分类:
其他好文 时间:
2015-04-06 00:57:16
阅读次数:
145
Matrix Power Series 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #inclu...
分类:
其他好文 时间:
2015-04-05 23:23:15
阅读次数:
168
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:
其他好文 时间:
2015-04-05 21:48:35
阅读次数:
115
就向书上说得那样,如果模式串P的第i行出现在文本串T的第r行第c列,则cnt[r-i][c]++;还有个很棘手的问题就是模式串中可能会有相同的串,所以用repr[i]来记录第i个模式串P[i]第一次出现的位置。如果repr[i] == i,说明这个模式串之前没有重复过,可以加进自动机里去。有重复的话...
分类:
其他好文 时间:
2015-04-05 21:44:27
阅读次数:
127