Medium
https://leetcode.com/problems/partition-equal-subset-sum/
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.
Note:
- Each of the array element will not exceed 100.
- The array size will not exceed 200.
Example 1:
1 |
Input: [1, 5, 11, 5] |
2019.9.20 没做出来,参考 https://blog.csdn.net/fuxuemingzhu/article/details/79787425
这道题我真的…照着 0-1 背包的思路写,还是有的题总是过不了,看来我还需要加强背包系列的知识点。
方法:
0-1 背包问题
1 |
class (object): |
类似题目:
近期评论