一、题目 1、审题 2、分析 给出顶点数、指向当前顶点的前驱顶点,判断当前顶点组成的图是否是一个有向无环图。 二、解答 1、思路: 方法一、 采用拓扑排序 ①、定义数组 matrix[][] 存储从 i 指向 j 的边,curArr[] 存储指向当前顶点的边数。并初始化这两个数组; ②、将没有前驱的 ...
分类:
其他好文 时间:
2018-10-24 22:18:33
阅读次数:
200
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2 ...
分类:
其他好文 时间:
2018-10-24 10:56:01
阅读次数:
142
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f ...
分类:
其他好文 时间:
2018-10-23 22:54:09
阅读次数:
148
class Solution { public: void setZeroes(vector>& matrix) { vector> store; int m = matrix.size(); int n = matrix[0].size(); for(int i=0;i temp; ... ...
分类:
其他好文 时间:
2018-10-23 17:57:20
阅读次数:
106
On a 2 dimensional grid with R rows and C columns, we start at (r0, c0) facing east. Here, the north west corner of the grid is at the first row and c ...
分类:
其他好文 时间:
2018-10-21 13:09:21
阅读次数:
236
具体定义:https://en.wikipedia.org/wiki/Positive-definite_matrix ...
分类:
其他好文 时间:
2018-10-20 22:44:58
阅读次数:
213
场景:后端返回的是[[‘2015-1-1’,1,1],[‘2015-1-2’,1,2]]这样的Json数组,代表的意思是2015-1-1这个日期下新增的数据为1,减少的数据为1,2015-1-2这个日期,新增的数据为1,减少的数据为2,但是在统计图表上要在x轴显示时间,y轴显示新增和减少的数据这时,就要把数据转化成[[‘2015-1-1’,’2015-1-2’],[1,1],[1,2]]这样的结构
分类:
编程语言 时间:
2018-10-20 13:37:18
阅读次数:
114
Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: AC code: Runtime: 0 ms, faster than 1 ...
分类:
其他好文 时间:
2018-10-19 21:53:27
阅读次数:
104
本文介绍的例子在Android安卓手机上测试通过。 先看看效果吧。可以看到这个开发好的安卓应用有三个按钮:Zoom In缩小图片,Zoom Out放大图片和Save保存。 初始页面: 可以在左边边框自由移动图片,图片下面的调试界面debug screen会显示详细的图片矩阵matrix信息: 点击S ...
分类:
编程语言 时间:
2018-10-18 16:58:26
阅读次数:
143