Jump to content

Solve hanging lantern problem: Difference between revisions

m (added related task)
Line 1,137:
print(int(res))
</lang>
 
===Showing Sequences===
<lang python>def seq(x):
if not any(x):
yield tuple()
 
for i, v in enumerate(x):
if v:
for s in seq(x[:i] + [v - 1] + x[i+1:]):
yield (i+1,) + s
 
# an example
for x in seq([1, 2, 3]):
print(x)</lang>
 
=={{header|Raku}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.