完全背包
文章平均质量分 53
memcpy0
希望探索文理结合的自由之路。
展开
-
LeetCode 1449. Form Largest Integer With Digits That Add up to Target【动态规划/字符串】困难
Given an array of integers cost and an integer target. Return the maximum integer you can paint under the following rules: The cost of painting a digit (i+1) is given by cost[i] (0 indexed). The total cost used must be equal to原创 2021-06-13 19:08:29 · 169 阅读 · 0 评论 -
LeetCode C++ 518. Coin Change 2【动态规划/完全背包】
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin. Example 1: Input: amount = 5, co原创 2021-03-27 15:33:36 · 314 阅读 · 0 评论 -
LeetCode C++ 面试题 08.11. Coin LCCI【Dynamic Programming/Math】中等
Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents), and pennies (1 cent), write code to calculate the number of ways of representing n cents. (The result may be large, so you should return it modulo 1000000007) Example1: I原创 2021-01-05 23:47:28 · 168 阅读 · 0 评论 -
LeetCode C++ 279. Perfect Squares【BFS/动态规划/数学】中等
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 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2: Input: n = 13 Output: 2 Explanation: 13 = 4 + 9. 题意原创 2020-08-25 21:11:56 · 331 阅读 · 0 评论