码迷,mamicode.com
首页 >  
搜索关键字:minimum    ( 3256个结果
[LeetCode]76.Minimum Window Substring
题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = “ADOBECODEBANC” T = “ABC” Minimum window is “BANC”.Note...
分类:Windows程序   时间:2015-02-24 13:48:53    阅读次数:210
LeetCode 笔记24 Palindrome Partitioning II (智商碾压)
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs...
分类:其他好文   时间:2015-02-24 13:43:16    阅读次数:150
LeetCode 154. Find Minimum in Rotated Sorted Array II
二分搜索,和LeetCode 153. Find Minimum in Rotated Sorted Array相似。 只是在num[begin] == num[mid]时,需要binary_search(++ begin, end, num); 这时仅将begin移进一位,并没有进行二分查找。 所以如测试用例为 num = {1, 1, 1, 1, 1, ..., 1}等特殊情况时,最坏情况...
分类:其他好文   时间:2015-02-24 00:50:43    阅读次数:206
HDU1394 Minimum Inversion Number 线段树+数学
Problem DescriptionThe inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, …, an, if we move...
分类:其他好文   时间:2015-02-23 23:44:23    阅读次数:400
LeetCode 153. Find Minimum in Rotated Sorted Array
二分查找。 因为在旋转前的数组是排好序了的, 所以当num[begin] > num[mid]时,表示我们要搜寻的最小数字在num[begin, ..., mid]之间; 反之,num[begin] 例:考虑num = {5, 6, 7, 1, 2, 3, 4}, begin = 0, end = 6, mid = 3 num[begin] = 5 > num[m...
分类:其他好文   时间:2015-02-23 23:43:09    阅读次数:350
LeetCode 152. Maximum Product Subarray
动态规划。 dp[0][i]: A[0, ..., i-1]的maximum product subarray, dp[1][i]: A[0, ..., i-1)的minimum product subarray. 初始化dp[0][0] = dp[1][0] = A[0]. 递推公式: dp[0][i] = max(dp[0][i-1]*A[i], dp[1][i-1]*A[i])...
分类:其他好文   时间:2015-02-23 20:08:09    阅读次数:163
hdu 1679 The Unique MST 次小生成树 简单题
Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V', E'), with the following properties: 1...
分类:其他好文   时间:2015-02-23 15:33:46    阅读次数:257
Minimum Adjustment Cost
Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target.If the array ...
分类:其他好文   时间:2015-02-23 15:26:38    阅读次数:115
RMQ问题的Sparse-Table算法
范围最小值问题(Range Minimum Query) 给出一个n个元素的数组,设计数据结构使得支持查询操作Query(L,R) 计算[L,R]中最小值 Tarjan的Sparse-Table算法预处理时间为O(nlogn) 查询只需要O(1)而且常数很小。假设dp[i][j]表示从第i个数开始的2^j个数的最小值。 有下列公式:dp[i][j] = min(dp[i,j-1],dp[i+2...
分类:编程语言   时间:2015-02-22 21:57:56    阅读次数:200
HDU 3473 Minimum Sum
Minimum SumTime Limit: 16000/8000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2667Accepted Submission(s): 609Problem...
分类:其他好文   时间:2015-02-22 20:44:41    阅读次数:207
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!