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 longest palindrom...
分类:
其他好文 时间:
2015-05-24 14:19:55
阅读次数:
146
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from th...
分类:
编程语言 时间:
2015-05-24 12:51:44
阅读次数:
114
题目链接:http://poj.org/problem?id=2533思路分析:该问题为经典的最长递增子序列问题,使用动态规划就可以解决;1)状态定义:假设序列为A[0, 1, .., n],则定义状态dp[i]为以在所有的递增子序列中以A[i]为递增子序列的最后一个数字的所有递增子序列中的最大长度...
分类:
其他好文 时间:
2015-05-23 21:13:07
阅读次数:
133
最短路+二分。对容量进行二分,因为容量和时间是单调关系的,容量越多,能用的边越少,时间会不变或者增加。因为直接暴力一个一个容量去算会TLE,所以采用二分。#include#include#include#include#include#includeusing namespace std;const...
分类:
其他好文 时间:
2015-05-23 16:40:59
阅读次数:
107
题意:
Two soldiers are playing a game. At the beginning first of them chooses a positive integer
n and gives it to the second soldier. Then the second one tries to make maximum possible number of ro...
分类:
其他好文 时间:
2015-05-23 14:18:31
阅读次数:
174
问题描述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 complete at most k transactions.Example
Given price...
分类:
其他好文 时间:
2015-05-23 11:30:26
阅读次数:
124
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
编程语言 时间:
2015-05-23 10:03:37
阅读次数:
114
public class Solution { public int maxSubArray(int[] nums) { if (nums == null || nums.length <= 0) { return 0; } in...
分类:
其他好文 时间:
2015-05-22 11:08:40
阅读次数:
106
1 Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determ...
分类:
编程语言 时间:
2015-05-21 12:48:33
阅读次数:
144
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-05-20 08:15:30
阅读次数:
133