题目:在一个数组中找到一个子数组,让子数组的乘积最大,比如【2,3,-2,4】返回6 思路:之前自己想到的思路是对于一个int类型的数组,只要负数的个数是偶数,那么乘积肯定是全局乘就可以了,然后对于负数个数是奇数的情况,那么我们就找到最前和最后的一个负数,然后分别计算其前后子数组的乘积就可以了!因为 ...
分类:
编程语言 时间:
2017-05-10 00:14:22
阅读次数:
126
题目: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Example Given the below binary tree: 1 / \ 2 3 ...
分类:
其他好文 时间:
2017-05-09 21:39:12
阅读次数:
121
?? 题意:给定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