算法
文章平均质量分 81
目标是技术宅
这个作者很懒,什么都没留下…
展开
-
动态规划最短路算法总结——以【Layout】差分约束为例
动态规划最短路算法总结 ——以【Layout】差分约束为例 一.差分约束的概念 如果一个系统由nnn个变量和mmm个不等式组成,并且这mmm个不等式对应的系数矩阵每一行有且仅有一个1和-1,其它的都为0,这样的系统成为差分约束系统。 将不等式x[i]−x[j]≤a[k]x[i]−x[j]≤a[k]x[i]-x[j]\leq a[k] 变形为x[i]≤x[j]+a[k]x[i]≤x[j]...原创 2018-04-15 09:48:48 · 912 阅读 · 0 评论 -
动态规划之背包问题
动态规划之背包问题 1.01背包问题 题目描述: 有N件物品和一个容量为V的背包。放入第iii 件物品耗费的空间是CiCiC_i ,得到的价值是WiWiW_i,求解将哪些物品装入背包可使价值总和最大。 状态转移方程: F[i][v]F[i][v]F[i][v] = max(F[i−1][v],F[i−1][v−Ci]+Wi)max(F[i−1][v],F[i−1][v−Ci...原创 2018-04-15 14:01:23 · 199 阅读 · 0 评论 -
Two Sum
LeetCode 题目:Two Sum 语言:Python 题目描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactl...原创 2018-08-27 13:27:10 · 252 阅读 · 0 评论 -
Reverse Integer
LeetCode 题目: Reverse Integer Python 题目描述: Given a 32-bit signed integer, reverse digits of an integer. 例子: Input: 123 Output: 321 题目中有个特别需要注意的地方:32位整数,32位整数的范围是[-2147483648, 2147483647]。 如...原创 2018-08-27 15:07:14 · 219 阅读 · 0 评论