Solve hanging lantern problem: Difference between revisions

Content deleted Content added
Markjreed (talk | contribs)
→‎{{header|Raku}}: Add implementation.
Markjreed (talk | contribs)
→‎{{header|Julia}}: Correct treatment of duplicate column sizes; see talk page.
Line 47:
 
=={{header|Julia}}==
{{incorrect|Julia|Columns with the same number of lanterns should be distinct; see talk page.}}
<lang ruby>""" rosettacode.org /wiki/Lantern_Problem """
 
Line 55 ⟶ 54:
inputs = [parse(Int, i) for i in split(readline(), r"\s+")]
n = popfirst!(inputs)
takedownways = unique(permutations(reduce(vcat, [fill(ni, ninputs[i]) for ni in 1:length(inputs)])))
println("\nThere are ", length(takedownways), " ways to take these ", n, " columns down:")
for way in takedownways