求和
Data Structures & Algorithms · 5 notes
- Partition Equal Subset Sumhistorical
Given a non-empty array containing only positive integers, determine whether the array can be partitioned into two subsets whose sums are equal.
- Perfect Squareshistorical
Given a positive integer n, find several perfect-square numbers (such as 1, 4, 9, 16, ...) whose sum equals n. You need to minimize the number of perfect squares used.
- Target Sumhistorical
Assign a plus or minus sign to each number in a nonnegative integer array and count the assignments whose sum equals the target S.
- Combination Sumhistorical
Given an array candidates containing no duplicate elements and a target number target, find all combinations of numbers in candidates whose sum equals target.
- Coin Changehistorical
Given coins of different denominations and a total amount, write a function to compute the minimum number of coins needed to make up that amount. If no combination of coins can make up the amount, return -1.