动态规划
文章平均质量分 55
onlyou2030
内心仰望理想的人都在埋头苦干!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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原创 2015-10-17 15:57:23 · 324 阅读 · 0 评论 -
0-1背包问题
问题描述: 有N件物品和一个容量为W的背包。第i件物品的重量是w[i],价值是v[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。 这个问题的特点是:每种物品只有一件,可以选择放或者不放。 最优子结构:问题的最优解由相关子问题的最优解组合而成,而这些子问题可以独立求解。 关键问题:如何寻找一个最优子结构(子问题)? 子问题:DP[i原创 2015-09-21 15:26:00 · 329 阅读 · 0 评论 -
leetcode 52: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,−原创 2015-11-16 20:59:19 · 346 阅读 · 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 rea原创 2015-11-19 20:32:10 · 309 阅读 · 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原创 2015-11-19 20:56:09 · 302 阅读 · 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 permitt原创 2015-11-24 20:18:27 · 269 阅读 · 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? 思路: 这题和前面Unique Path原创 2015-11-24 19:06:19 · 265 阅读 · 0 评论 -
leetcode 87:Scramble String
题目: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great /原创 2015-12-02 14:13:13 · 518 阅读 · 0 评论
分享