You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -981,7 +981,7 @@
981
981
375| [Guess Number Higher or Lower II](https://leetcode.com/problems/guess-number-higher-or-lower-ii/)| [Python](./leetcode_python//Dynamic_Programming/guess-number-higher-or-lower-ii.py) | _O(n^2)_ | _O(n^2)_ | Medium | | AGAIN (not start)
982
982
377| [Combination Sum IV](https://leetcode.com/problems/combination-sum-iv/)| [Python](./leetcode_python//Dynamic_Programming/combination-sum-iv.py) | _O(nlogn + n * t)_| _O(t)_ | Medium |Curated Top 75, AGAIN, dp basic ,`fb`| AGAIN******** (3)
983
983
403| [Frog Jump](https://leetcode.com/problems/frog-jump/)| [Python](./leetcode_python//Dynamic_Programming/frog-jump.py) | _O(nlogn + n * t)_| _O(t)_ | Hard |dfs, bfs, Memoization dfs, dp, amazon, tik-tok, m$| AGAIN (not start)
984
-
416 | [Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/) | [Python](./leetcode_python//Dynamic_Programming/partition-equal-subset-sum.py) | _O(n * s)_ | _O(s)_ | Medium || AGAIN (not start)
418 | [Sentence Screen Fitting](https://leetcode.com/problems/sentence-screen-fitting/) | [Python](./leetcode_python//Dynamic_Programming/sentence-screen-fitting.py) | _O(r + n * c)_ | _O(n)_ | Medium |🔒, `dp`, `google`| AGAIN (not start)
986
986
467 | [Unique Substrings in Wraparound String](https://leetcode.com/problems/unique-substrings-in-wraparound-string/) | [Python](./leetcode_python//Dynamic_Programming/unique-substrings-in-wraparound-string.py) | _O(n)_ | _O(1)_ | Medium || AGAIN (not start)
987
987
471 | [Encode String with Shortest Length](https://leetcode.com/problems/encode-string-with-shortest-length/) | [Python](./leetcode_python//Dynamic_Programming/encode-string-with-shortest-length.py) | _O(n^3)_ on average | _O(n^2)_ | Medium |🔒, `dp`, `google`| AGAIN (not start)
Copy file name to clipboardExpand all lines: leetcode_python/Dynamic_Programming/partition-equal-subset-sum.py
+110-4Lines changed: 110 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,113 @@
1
+
"""
2
+
3
+
416. Partition Equal Subset Sum
4
+
Medium
5
+
6
+
Given a non-empty array nums 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.
7
+
8
+
9
+
10
+
Example 1:
11
+
12
+
Input: nums = [1,5,11,5]
13
+
Output: true
14
+
Explanation: The array can be partitioned as [1, 5, 5] and [11].
15
+
Example 2:
16
+
17
+
Input: nums = [1,2,3,5]
18
+
Output: false
19
+
Explanation: The array cannot be partitioned into equal sum subsets.
0 commit comments