摘要: 标签:动态规划 题目描述: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Example For example, g 阅读全文
posted @ 2016-09-09 23:50 whaochen 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 标签: 动态规划 解题思路 1. 这道题最重要的是,存在三个字符串,但是并不需要两个二维矩阵来进行解,因为可以使用i+j-1来代表s3的下标,这样就可以通过i和j来遍历s3了。因为对于任何一个合法的交叉字符串都会有,s3(i+j-1)=s1(i-1) 或者s3(i+j-1) = s2(j-1) 2. 阅读全文
posted @ 2016-09-09 23:08 whaochen 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 标签:动态规划 描述: 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 阅读全文
posted @ 2016-09-09 05:27 whaochen 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 标签:动态规划 题目描述: 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 阅读全文
posted @ 2016-09-09 01:43 whaochen 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 标签: 动态规划 问题描述: There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no mor 阅读全文
posted @ 2016-09-08 02:58 whaochen 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 标签: 动态规划 描述: Given an integer array nums with all positive numbers and no duplicates, find the number of possible combinations that add up to a positi 阅读全文
posted @ 2016-09-07 22:26 whaochen 阅读(608) 评论(0) 推荐(0) 编辑
摘要: 标签:动态规划 问题描述: Given n items with size Ai and value Vi, and a backpack with size m. What's the maximum value can you put into the backpack? 解题思路: 又是一道恶 阅读全文
posted @ 2016-09-07 00:39 whaochen 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 标记: 动态规划 问题描述: Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack? Example If we have 4 item 阅读全文
posted @ 2016-09-05 03:53 whaochen 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 标签: 动态规划 描述: Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification 阅读全文
posted @ 2016-09-04 11:57 whaochen 阅读(1892) 评论(1) 推荐(0) 编辑
摘要: 标签:动态规划 题目描述: Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. 解题思路: 这一题是非常经典的动态规划问题,在解题思路上可以按 阅读全文
posted @ 2016-09-04 07:08 whaochen 阅读(231) 评论(0) 推荐(0) 编辑