Problem DescriptionBean-eating is an interesting game, everyone owns an M*N matrix, which is filled with different qualities beans. Meantime, there is...
分类:
其他好文 时间:
2015-07-17 20:30:46
阅读次数:
169
1.6 Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you d...
分类:
其他好文 时间:
2015-07-17 07:07:39
阅读次数:
126
1.7 Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0.LeetCode中的原题,请参见我之前的博客Set Matrix Zeroes 矩...
分类:
其他好文 时间:
2015-07-17 07:07:00
阅读次数:
110
题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解题思路:In-place So...
分类:
其他好文 时间:
2015-07-16 23:53:38
阅读次数:
116
题目:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted fro...
分类:
其他好文 时间:
2015-07-16 18:38:36
阅读次数:
83
方案一: (1)获取ImageView对应的图片,并将其转成Bitmap; (2)创建Matrix对象; (3)调用matrix.setRotate( );设置旋转度数 (4)重新创建bitmap (5)ImageView设置ImageBitmap ...
分类:
移动开发 时间:
2015-07-16 18:24:30
阅读次数:
120
树状数组只能实现线段树区间修改和区间查询的功能,可以代替不需要lazy tag的线段树,且代码量和常数较小
首先定义一个数组 int c[N]; 并清空 memset(c, 0, sizeof c);
1、单点修改 : c[x] += y; 对应的函数是 change(x, y);
2、求前缀和 : 对应的函数是 int sum(x)
两种操作的复杂度都是O(lo...
分类:
编程语言 时间:
2015-07-16 16:44:53
阅读次数:
170
Problem: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?思路:顺时针方...
分类:
其他好文 时间:
2015-07-16 11:23:49
阅读次数:
121
题目:
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...
分类:
编程语言 时间:
2015-07-15 22:54:53
阅读次数:
189
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.public class Solution { public...
分类:
其他好文 时间:
2015-07-15 22:39:04
阅读次数:
270