dp
akihiro_the_coder
这个作者很懒,什么都没留下…
展开
-
LeetCode 70. Climbing Stairs 动态规划java解题日记
什么是动态规划Dynamic programming, like the divide-and-conquer method, solves problems by combining the solutions to subproblems.在Introduction to algorithms中,书里提到When developing a dynamic-programming algo...原创 2019-02-19 11:54:35 · 146 阅读 · 2 评论 -
LeetCode 322. Coin Change找零钱 动态规划 java
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money...原创 2019-02-19 12:13:53 · 349 阅读 · 0 评论 -
LeetCode 416. Partition Equal Subset Sum 动态规划解题日记
题意:给你一个数组,要你判断这个数组是否可以被切分成两个和相同的子数组。本题跟昨天post的找零钱有一些相似。注意:dp[j] = dp[j] || dp[j-nums[i]] 这句话的意思是,我们要判断是否可以通过nums里面的数字凑到j。随着i增加,dp[j-nums[i]]就在检查每一个nums里面的nums[i]是不是可以在原有的基础上加nums[i]得到j。也就是说,如果nums[i]...原创 2019-02-20 02:46:51 · 211 阅读 · 0 评论