Skip to content

Instantly share code, notes, and snippets.

@duyquang6
Created May 8, 2020 14:09
Show Gist options
  • Save duyquang6/738e35a07b23dfd03da4a87fa98716e0 to your computer and use it in GitHub Desktop.
Save duyquang6/738e35a07b23dfd03da4a87fa98716e0 to your computer and use it in GitHub Desktop.
class Solution:
def minPartitions(self, used: [int], total: [int]) -> int:
res = sum(used)
total.sort(reverse=True)
for i, v in enumerate(total):
res -= v
if res <= 0:
return i+1
print(Solution().minPartitions([3, 2, 1, 3, 1], [3, 5, 3, 5, 5]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment