题意: 给定两组各n个数,可任意调整同一组数之中数字的顺序,求 sum xi*yi i=1..n的最小值。Small: n2时: 假设最优解中,存在 ya,yb,有b>a且ya>yb(不是按照降序排列的),显然根据n=2,交换他们的位置,就会得到更小的答案。所以,假设正确。 另外,还有很重要的...
分类:
其他好文 时间:
2014-10-20 16:47:48
阅读次数:
131
Recovery time is the minimum length of time an asynchronous control signal, for example, and preset, must be stable before the next active clock edge....
分类:
其他好文 时间:
2014-10-20 14:56:25
阅读次数:
298
leetcode上的一道题 题意大致是:给定一个循环移位后的排序数组,求数组的最小值 抛开假设不谈,实际上就是一个求数组最小值的问题,可以o(n)扫一遍记录最小值;也相当于求[0,vec.size()-1]的区间最小值问题,可以转化成线段树树状数组处理 本问题的假设可以利用:数组是“片段”有序的,可...
分类:
其他好文 时间:
2014-10-20 14:56:04
阅读次数:
143
【题目】
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4
5 6 7 0 1 2).
Find the minimum element.
You may assume no duplicate...
分类:
其他好文 时间:
2014-10-20 11:51:28
阅读次数:
239
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:
其他好文 时间:
2014-10-20 07:33:59
阅读次数:
234
【题目】
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down o...
分类:
其他好文 时间:
2014-10-19 21:25:37
阅读次数:
247
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo...
分类:
其他好文 时间:
2014-10-19 16:56:55
阅读次数:
192
Minimum Path Sum
Total Accepted: 19916 Total
Submissions: 63796My Submissions
Question
Solution
Given a m x n grid filled with non-negative numbers, find a path from top left to b...
分类:
其他好文 时间:
2014-10-19 13:03:26
阅读次数:
162
Problem Description
在图论中,树:任意两个顶点间有且只有一条路径的图。
生成树:包含了图中所有顶点的一种树。
最小生成树:对于连通的带权图(连通网)G,其生成树也是带权的。生成树T各边的权值总和称为该树的权,权最小的生成树称为G的最小生成树(Minimum Spanning Tree)。最小生成树可简记为MST。
但是,对于一个图而言,最小生成树并不是唯一的。
现...
分类:
其他好文 时间:
2014-10-19 11:36:48
阅读次数:
131
1、类中递归调用添加self;2、root为None,返回03、root不为None,root左右孩子为None,返回14、返回l和r最小深度,l和r初始为极大值; 1 # Definition for a binary tree node 2 # class TreeNode: 3 # ...
分类:
编程语言 时间:
2014-10-19 10:13:07
阅读次数:
222