Solve hanging lantern problem: Difference between revisions

→‎{{header|Julia}}: Correct treatment of duplicate column sizes; see talk page.
(→‎{{header|Raku}}: Add implementation.)
(→‎{{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
1,481

edits