LintCode 433: https://www.lintcode.com/problem/number-of-islands/description LintCode 434: https://www.lintcode.com/problem/number-of-islands-ii/descr ...
分类:
其他好文 时间:
2019-02-08 10:32:02
阅读次数:
172
Two images A and B are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.) We translate on ...
分类:
其他好文 时间:
2019-02-07 23:23:10
阅读次数:
214
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which ...
分类:
其他好文 时间:
2019-02-07 19:01:55
阅读次数:
193
给出一组正整数$x,n,r$,使得$r^2\equiv x(mod\: n)$,求出所有满足该等式的$r$。 假设有另一个解$r'$满足条件,则有$r^2-r'^2=kn$ 因式分解,得$(r+r')(r-r')=kn$ 将$n$分解成$a*b$,则有$\left\{\begin{matrix}r+ ...
分类:
其他好文 时间:
2019-02-07 16:27:09
阅读次数:
195
import numpy,math def softmax(inMatrix): m,n = numpy.shape(inMatrix) outMatrix = numpy.mat(numpy.zeros((m,n))) soft_sum = 0 for idx in range(0,n): out... ...
分类:
编程语言 时间:
2019-02-06 11:58:07
阅读次数:
202
Difficulty: Medium Problem On a 2 dimensional grid with rows and columns, we start at facing east. Here, the north west corner of the grid is at the f ...
分类:
其他好文 时间:
2019-02-05 13:03:13
阅读次数:
172
题目要求 Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and colum ...
分类:
其他好文 时间:
2019-02-05 10:37:29
阅读次数:
192
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means t ...
分类:
其他好文 时间:
2019-02-03 01:03:12
阅读次数:
158
题目链接:(vjudge) "戳我" 和上面那个matrix 比较像。 大概题意就是给你一个n m的矩阵,然后可以选择其中一个数字进行修改(当然也可以不修改),使得矩阵的最大子矩阵尽可能小。最后输出这个值。 我们$n^2$遍历i,j,对于一个位置$[i,j]$看看如果对它进行更改结果会如何。显然如果 ...
分类:
其他好文 时间:
2019-02-02 00:44:19
阅读次数:
188
题目链接:(vjudge) "戳我" ~~从今天开始 不咕咕 地填坑啦~~ 考虑一般的求最大子矩阵和。。。我们一般都是DP,或者直接上悬线法递推。 下面附一个DP的代码: cpp include include include include define MAXN 310 using namesp ...
分类:
其他好文 时间:
2019-02-01 23:26:32
阅读次数:
213