Largest int from concatenated ints: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: added comment in the REXX section header. -- ~~~~ |
D entry: maxCat3 is now less elegant but works with [10, 1010] |
||
Line 70:
=={{header|D}}==
The three algorithms. Uses the second module from the Permutations Task.
<lang d>import std.stdio, std.algorithm, std.
auto maxCat1(in int[] arr) {
Line 80:
}
auto maxCat3(in int[] arr) {
immutable maxl = arr.reduce!max.text.length;
return arr.to!(string[])
.schwartzSort!(s => s.replicate(maxl/s.length + 1), "a > b")
}
|