Skip to content

Commit

Permalink
Update Level 2b: Please Pass the Coded Messages.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluorax authored Nov 15, 2020
1 parent 7bfcc65 commit bd8de97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Level 2b: Please Pass the Coded Messages.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
from itertools import combinations

def solution(l):
# Your code here
l.sort(reverse = True)
for i in reversed(range(1, len(l) + 1)):
for tup in combinations(l, i):
if sum(tup) % 3 == 0: return int(''.join(map(str, tup)))
return 0

0 comments on commit bd8de97

Please sign in to comment.