summaryrefslogtreecommitdiff
path: root/please-pass-the-coded-messages/solution.py
diff options
context:
space:
mode:
Diffstat (limited to 'please-pass-the-coded-messages/solution.py')
-rw-r--r--please-pass-the-coded-messages/solution.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/please-pass-the-coded-messages/solution.py b/please-pass-the-coded-messages/solution.py
index 91fc5ca..586841e 100644
--- a/please-pass-the-coded-messages/solution.py
+++ b/please-pass-the-coded-messages/solution.py
@@ -1,28 +1,2 @@
-import itertools
-
-
def solution(l):
- res = 0
-
- # Get all the permutations of the list, without duplicates
- for r in range(0, len(l) + 1, 1):
-
- for i in itertools.permutations(l, r):
-
- # ignore the empty set
- if i == ():
- continue
-
- # now we need to convert tuples into an int
- # such as (1, 2, 3) become 123
- num = int("".join(str(x) for x in i))
-
- # now we check if the number is divisible by 3
- # and greater than the latest divisible
- if num % 3 == 0 and num > res:
- res = num
- return res
-
-
-print(solution([3, 1, 4, 1])) # == 4311
-print(solution([3, 1, 4, 1, 5, 9])) # == 94311
+ # Your code here