?? 题意:给定n个数,求两段连续不重叠子段的最大和。 思路非常easy。把原串划为两段。求两段的连续最大子串和之和,这里要先预处理一下,用lmax数组表示1到i的最大连续子串和,用rmax数组表示n到i的最大连续子串和,这样将时间复杂度降为O(n)。 #include<cstdio> #inclu ...
分类:
其他好文 时间:
2017-05-09 20:46:37
阅读次数:
146
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4932 Miaomiao's Geometry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Other ...
分类:
其他好文 时间:
2017-05-09 20:38:14
阅读次数:
140
http://www.lintcode.com/zh-cn/problem/binary-tree-maximum-path-sum/# 注意点: root == null ,return Integer.MIN_VALUE 就说明为了一定排除这个结点,将这个结点值设为最小值,也说明路径中是至少包含 ...
分类:
其他好文 时间:
2017-05-09 12:34:22
阅读次数:
199
Problem statement: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Exampl ...
分类:
其他好文 时间:
2017-05-09 11:16:06
阅读次数:
115
1,头部需加 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 还有就是搜索引擎写上即可; 2,头部header,面包屑名称header>header-inner>h1#logo ...
分类:
Web程序 时间:
2017-05-08 16:06:44
阅读次数:
180
题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,- ...
分类:
其他好文 时间:
2017-05-07 23:07:54
阅读次数:
169
二分图匹配 极大匹配(Maximal Matching)是指在当前已完成的匹配下,无法再通过增加未完成匹配的边的方式来增加匹配的边数。最大匹配(maximum matching)是所有极大匹配当中边数最大的一个匹配。选择这样的边数最大的子集称为图的最大匹配问题。 如果一个匹配中,图中的每个顶点都和图 ...
分类:
其他好文 时间:
2017-05-07 18:43:50
阅读次数:
148
Methods of adding more resources for a particular application fall into two broad categories: horizontal and vertical scaling.[5] To scale horizontall ...
分类:
其他好文 时间:
2017-05-07 14:50:41
阅读次数:
194
Problem D - Maximum Product Time Limit: 1 second Given a sequence of integers S = {S1, S2, ..., Sn}, you should determine what is the value of the max ...
分类:
其他好文 时间:
2017-05-07 14:06:48
阅读次数:
148
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple ...
分类:
其他好文 时间:
2017-05-07 11:48:49
阅读次数:
203