题目链接:http://codeforces.com/problemset/problem/332/B 题目大意:给你n个数和一个整数k,要求找到不相交的两个长度为k的区间,使得区间和最大,输出这两个区间的起点。解题思路:先计算前缀和,然后预处理出maxsum[i],maxsum[i]记录i~n最大 ...
分类:
其他好文 时间:
2018-06-04 11:25:10
阅读次数:
204
题目描述: Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Note: There may be more than one LIS combinatio ...
分类:
其他好文 时间:
2018-06-03 14:30:57
阅读次数:
142
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi ...
分类:
其他好文 时间:
2018-06-03 14:20:25
阅读次数:
146
求二叉树的最大深度,是常见的一种二叉树算法问题,主要解决办法有两种,一种是使用递归求解,另一种是非递归方式求解。这里给出递归求解方法。递归方法无需判断左右子树是否为空。 问题来源于https://leetcode.com/problems/maximum-depth-of-binary-tree/d ...
分类:
其他好文 时间:
2018-06-02 19:35:32
阅读次数:
179
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: ...
分类:
其他好文 时间:
2018-06-02 12:55:40
阅读次数:
157
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" /> 在网页的<head>中增加以上这句话,可 ...
分类:
移动开发 时间:
2018-06-02 11:13:08
阅读次数:
235
网络流是什么? 不急我们慢慢来讲。 首先我们先看看最大流 1.背景 管道网络中每条边的最大通过能力(容量)是有限的,实际流量不超过容量。最大流问题(maximum flow problem),一种组合最优化问题,就是要讨论如何充分利用装置的能力,使得运输的流量最大,以取得最好的效果。求最大流的标号算 ...
分类:
编程语言 时间:
2018-06-01 22:12:53
阅读次数:
232
How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming ...
分类:
其他好文 时间:
2018-05-30 12:06:50
阅读次数:
174
LeetCode 地址:https://leetcode.com/problems/maximum-gap/description/ 题目描述 给定一个未排序数组,找出排序后的元素之间的最大间隔。 要求用线性时间复杂度实现。 例如:输入为【3,6,9,1,10】,输出应为最大间隔3。 题目分析 线性 ...
分类:
编程语言 时间:
2018-05-29 20:43:21
阅读次数:
725