1 //1、先转置 2 //2、第一列与最后一列交换、第二列与倒数第二列交换、... 3 class Solution 4 { 5 public: 6 void rotate(vector<vector<int>>& matrix) 7 { 8 int n = matrix.size(); 9 fo ...
分类:
其他好文 时间:
2020-03-18 18:24:44
阅读次数:
44
在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 示例: 现有矩阵 matrix 如下: [ [1, 4, 7, 11, 15], [2, 5, 8, 12, 19] ...
分类:
编程语言 时间:
2020-03-18 17:11:24
阅读次数:
53
今天又开始啦 1.二维矩阵数组的基本格式: type arrayName [ ] [ ] = new type [ length1] [length2]; 例:int matrix [ ] [ ] = new int [4] [5]; 等价于: int matrix [ ] [ ] =new int ...
分类:
其他好文 时间:
2020-03-17 21:10:15
阅读次数:
54
与这道题相似的还有poj一道贴海报的题目,但这道题更加经典 典型的线段树合并求区间子段和模型,但是不同的是加了一个离散化,这也是最难的地方 本题思路: 1.设计lmax,rmax tmax来表示左边最长连续,总共最长连续和右边最长连续 2.设计懒标记为-1,0,1表示这区间是否都是黑或白或混合,如果 ...
分类:
其他好文 时间:
2020-03-17 15:29:37
阅读次数:
67
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input: ...
分类:
其他好文 时间:
2020-03-16 23:35:41
阅读次数:
72
Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it ...
分类:
其他好文 时间:
2020-03-16 09:41:48
阅读次数:
34
Graph Regularized Nonnegative Matrix Factorization for Data Representation 从几何角度来看, 数据通常是从嵌入在高维环境空间中的低维流形采样的。然后, 人们希望找到一个紧凑的表示, 它揭示了隐藏的语义, 同时尊重了内在的几何结 ...
分类:
其他好文 时间:
2020-03-15 20:38:53
阅读次数:
66
Volta架构是英伟达于2017年推出了新一代GPU架构,本文摘抄自英伟达Volta官方文档 ...
分类:
其他好文 时间:
2020-03-15 19:03:06
阅读次数:
128
1 import sys 2 class Solution: 3 def luckyNumbers (self, matrix: List[List[int]]) -> List[int]: 4 m = len(matrix) 5 n = len(matrix[0]) 6 luckyset = se ...
分类:
其他好文 时间:
2020-03-15 13:40:51
阅读次数:
56
http://poj.org/problem?id=1952 题目 你想买股票,方法是每次买的价格都比上一次的低(第一次不受限制)。你预先知道了每天的价格(= =),问最多能买几次,买这么多次产生的价格序列有多少种。 题解 难在价格序列的计数上面 如 \[5\quad3\quad1\quad4\qu ...
分类:
其他好文 时间:
2020-03-14 19:58:12
阅读次数:
51