$n \leq 2000000$的排列,问有多少满足:存在个$i$,使得$p_i \neq n$,且$p_j<p_i,j \in [i+1,i+K]$,$K \leq 2000000$是给定常数。膜$1e9+7$。 排列题还是比较菜。。 这次的切入点依然是排列题的经典套路--考虑将$n$加入$n-1 ...
分类:
其他好文 时间:
2018-03-15 22:17:15
阅读次数:
237
求最长摆动子序列。 Examples: 运行结果: 时间复杂度O(n^2),空间复杂度O(n)。 重点是这个优化的dp算法,时间复杂度O(n),空间复杂度O(1): 运行结果: 这个算法实在又简洁又易懂。 ...
分类:
其他好文 时间:
2018-03-15 11:24:41
阅读次数:
196
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scal ...
分类:
Web程序 时间:
2018-03-13 18:16:25
阅读次数:
296
53. Maximum Subarray 题目 解析 两个if的先后顺序 题目来源 "53. Maximum Subarray" "01 复杂度1 最大子列和问题(剑指offer和PAT)" ...
分类:
其他好文 时间:
2018-03-12 15:15:25
阅读次数:
163
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is re ...
分类:
其他好文 时间:
2018-03-12 00:05:40
阅读次数:
173
This uses the FastMember's meta-programming API for maximum performance. If you want to restrict it to particular members (or enforce the order), then ...
分类:
其他好文 时间:
2018-03-11 19:13:45
阅读次数:
172
以下是比较常见的题型 1、二叉树的深度/宽度 二叉树的最大深度 "104 Maximum Depth of Binary Tree" 二叉树的最小深度 "111 Minimum Depth of Binary Tree" 二叉树的最大宽度 "662 Maximum Width of Binary T ...
分类:
其他好文 时间:
2018-03-11 14:32:08
阅读次数:
254
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximu ...
分类:
其他好文 时间:
2018-03-11 11:49:02
阅读次数:
181
首先讲解HashMap的一些Field字段: static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16 默认初始化容量 向左移位4=2^4 = 16 static final int MAXIMUM_CAPACITY = 1 << 3 ...
分类:
其他好文 时间:
2018-03-11 02:40:10
阅读次数:
343
HashMap源码主要一些属性 //默认的初始化容量(2的n次方) static final int default_inital_capacity = 16; //最大指定容量为2的30次方 static final int maximum_capacity = 1 << 30; //默认的加载因 ...
分类:
其他好文 时间:
2018-03-11 00:14:33
阅读次数:
201