题意: 一条线段上有n张骨牌(n=1e7), 相邻骨牌距离为1,每张骨牌有其高度和推倒的花费,问最少的花费推倒所有的骨牌。 题解: 首先用单调栈维护每个位置往左(右)推能推倒的最远的骨牌 dp[i]表示1-i倒下的最小花费 转移显然只有两种 一种是第i张往左推动 另一种是找到往右推动能推倒i的最小花 ...
分类:
其他好文 时间:
2020-01-26 16:02:35
阅读次数:
75
具体错误日志如下:The resulting error log is as followsTraceback (most recent call last): File "train.py", line 441, in train() # train normally File "train.py... ...
分类:
其他好文 时间:
2020-01-25 10:19:41
阅读次数:
313
Introduction We have discussed in a previous article, in most common situation if we have to maintain two Arrays working consistantly, we should bette ...
分类:
其他好文 时间:
2020-01-24 13:16:42
阅读次数:
79
No enclosing instance of type Stu is accessible. Must qualify the allocation with an enclosing instance of type Stu (e.g. x.new A() where x is an inst ...
分类:
数据库 时间:
2020-01-24 00:14:19
阅读次数:
114
Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 ...
分类:
其他好文 时间:
2020-01-23 11:15:55
阅读次数:
75
42. Trapping Rain Water we need to find how many waters can each block[i] trap. So we need to find the left peak from block_0 to block[i-1] and find t ...
分类:
其他好文 时间:
2020-01-23 09:32:11
阅读次数:
89
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values ...
分类:
其他好文 时间:
2020-01-23 09:17:11
阅读次数:
93
Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, ...
分类:
其他好文 时间:
2020-01-22 11:06:54
阅读次数:
64
Given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and ...
分类:
其他好文 时间:
2020-01-22 10:56:58
阅读次数:
75
There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e The length of the garden is n). There ...
分类:
其他好文 时间:
2020-01-22 10:45:04
阅读次数:
78