![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
PKU_CXK
北京大学信息科学技术学院
展开
-
LeetCode | 32. Longest Valid Parentheses——最长有效括号匹配长度
Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which has原创 2017-05-26 23:38:09 · 356 阅读 · 0 评论 -
LeetCode | 53. Maximum Subarray
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,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the原创 2017-07-01 10:36:11 · 265 阅读 · 0 评论 -
LeetCode | 45. Jump Game II
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.Your goal is to reac原创 2017-06-26 23:28:26 · 286 阅读 · 0 评论 -
LeetCode | 62. Unique Paths
A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the botto原创 2017-07-17 16:11:24 · 250 阅读 · 0 评论 -
LeetCode | 63. Unique Paths II
Follow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.For ex原创 2017-07-21 20:28:12 · 305 阅读 · 0 评论 -
LeetCode | 64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at any原创 2017-07-21 20:42:41 · 281 阅读 · 0 评论 -
LeetCode | 70. Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive inte原创 2017-08-03 00:56:09 · 327 阅读 · 0 评论 -
LeetCode | 72. Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) In原创 2017-08-06 17:29:21 · 269 阅读 · 0 评论 -
POJ 2479 Maximum sum (动态规划)
题目链接 http://bailian.openjudge.cn/practice/2479/用两次动态规划,否则超时#include <iostream>#include <cstdio>using namespace std;int T, N;long long A[51000];long long front_sum[51000], bac...原创 2018-04-17 20:00:28 · 444 阅读 · 0 评论