Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import permutations
- class Solution:
- def Met(self, eggs, goal):
- # write your method here
- if sum(eggs) < goal:
- return False
- elif min(eggs) > goal:
- return False
- else:
- eggs[:] = [x for x in eggs if x <= goal]
- for i in range(1,len(eggs)):
- for j in list(permutations(eggs,i)):
- if sum(j) == goal :
- return True
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement