随笔分类 -  数据结构--动态规划

摘要:课程中, 作者将DP的问题分成以下几类: 1. 0/1 Knapsack, 0/1背包,6个题 0/1 Knapsack,0/1背包问题 Equal Subset Sum Partition,相等子集划分问题 Subset Sum,子集和问题 Minimum Subset Sum Differenc 阅读全文
posted @ 2020-03-27 23:21 乐乐章 阅读(229) 评论(0) 推荐(0)
摘要:Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. 阅读全文
posted @ 2019-03-12 15:46 乐乐章 阅读(191) 评论(0) 推荐(0)
摘要:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2 阅读全文
posted @ 2019-03-03 18:03 乐乐章 阅读(342) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumR 阅读全文
posted @ 2019-03-03 17:18 乐乐章 阅读(169) 评论(0) 推荐(0)
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 O 阅读全文
posted @ 2019-02-27 22:39 乐乐章 阅读(247) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: Input: 1 0 1 0 0 1 0 1 1 1 阅读全文
posted @ 2019-02-26 20:08 乐乐章 阅读(119) 评论(0) 推荐(0)
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are ar 阅读全文
posted @ 2019-02-22 15:51 乐乐章 阅读(502) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: I 阅读全文
posted @ 2019-02-21 21:55 乐乐章 阅读(210) 评论(0) 推荐(0)
摘要:198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only cons 阅读全文
posted @ 2018-04-09 17:50 乐乐章 阅读(164) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc 阅读全文
posted @ 2018-03-09 10:38 乐乐章 阅读(250) 评论(0) 推荐(0)
摘要:字符串子序列 300. Longest Increasing Subsequence(LIS最长递增子序列 动态规划) 输入:nums = [10,9,2,5,3,7,101,18] 输出:4 解释:最长递增子序列是 [2,3,7,101],因此长度为 4 。 dp[i] 表示以 nums[i] 这 阅读全文
posted @ 2018-03-08 22:30 乐乐章 阅读(133) 评论(0) 推荐(0)