-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem24.py
More file actions
87 lines (55 loc) · 862 Bytes
/
problem24.py
File metadata and controls
87 lines (55 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
count = 0
def permute(digs, soFar):
# print str(digs) + " " + str(soFar) + " " + str(count)
if digs == []:
global count
count = count + 1
if count == 1000000:
print soFar
for num in digs:
digs2 = list(digs)
soFar2 = list(soFar)
digs2.remove(num)
soFar2.append(num)
permute(digs2, soFar2)
thing = [0,1,2,3,4,5,6,7,8,9]
permute(thing,[])
# [1,2,3] [] 0
# [2,3] [1] 1
# [3] [1,2] 2
# [] [1,2,3] 3
# [2] [1,3] 2
# [] [1,3,2] 3
# [1,3] [2] 0
# [3] [2,1] 0
# [] [2,1,3] 1
# [1] [2,3] 0
# [] [2,3,1] 1
# 9
# 9
# 8 9
# 9 8
# 7 8 9
# 8 7 9
# 8 9 7
# 9 7 8
# 9 8 7
# 6 7 8 9
# 7 6 8 9
# 7 6 9 8
# 7 8 6 9
# 7 8 9 6
# 7 9 6 8
# 7 9 8 6
# 8 6 7 9
# 8 6 9 7
# 8 7 6 9
# 8 7 9 6
# 8 9 6 7
# 8 9 7 6
# 9 6 7 8
# 9 6 8 7
# 9 7 6 8
# 9 7 8 6
# 9 8 6 7
# 9 8 7 6