Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive te...
分类:
其他好文 时间:
2015-07-30 10:59:44
阅读次数:
146
LeetCode 5_Longest Palindromic Substring
题目描述:
Given a string S,
find the longest palindromic substring in S.
You may assume that the maximum length of S is
1000, and there exists one unique ...
分类:
其他好文 时间:
2015-07-29 15:57:00
阅读次数:
131
【053-Maximum Subarray(最大子数组和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the ar...
分类:
编程语言 时间:
2015-07-29 07:55:12
阅读次数:
131
LeetCode Maximum Product SubarrayDescriptionGiven a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value o...
分类:
其他好文 时间:
2015-07-28 22:54:07
阅读次数:
195
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x...
分类:
其他好文 时间:
2015-07-28 17:59:29
阅读次数:
96
Problem Definition:Given a string S, find the longest palindromic substring in S.You may assume that the maximum length of S is 1000, and there exists...
分类:
其他好文 时间:
2015-07-28 17:22:12
阅读次数:
111
题目描述:
求连续子序列,使乘积最大
解题思路:暴力枚举,枚举所有可能的序列
#include
#define MAXN 20
using namespace std;
int d[MAXN];
int main()
{
int t=0;
int n;
while(scanf("%d",&n)==1)
{
t++;
...
分类:
其他好文 时间:
2015-07-28 10:47:40
阅读次数:
111
/* Write a program to remove trailing blanks and tabs from each line of input,
and to delete entirely blank lines. */
#include
#define MAXLINE 1000 /* maximum input line size */
int getl...
分类:
其他好文 时间:
2015-07-27 23:04:22
阅读次数:
139
/* Write a function reverse(s) that reverses the character string s. Use it to
write a program that reverses its input a line at a time. */
#include
#define MAXLINE 1000 /* maximum input l...
分类:
其他好文 时间:
2015-07-27 23:00:48
阅读次数:
135
题目要求:
输入一个整型数组,有正数也有负数。数组中一个或连续的多个整数组成一个字数组。求所有子数组和的最大值。要求时间复杂度O(n).leetcode | Maximum Subarray 最大连续子序列的和:
http://blog.csdn.net/quzhongxin/article/details/46603957当前和是大于0,则对最大和是有贡献的,保留;
当前和是小于0,则对最大...
分类:
编程语言 时间:
2015-07-27 21:06:29
阅读次数:
120