Jump to content

Largest int from concatenated ints: Difference between revisions

Updated D entry
(Updated D entry)
Line 251:
<lang d>import std.stdio, std.algorithm, std.conv, std.array, permutations2;
 
auto maxCat1(in int[] arr) pure @safe {
return arr.to!(string[]).permutations.map!join.reduce!max;
}
 
auto maxCat2(in int[] arr) pure nothrow @safe {
return arr.to!(string[]).sort!q{b ~ a < a ~ b}.join;
}
 
auto maxCat3(in int[] arr) /*pure nothrow @safe*/ {
immutable maxL = arr.reduce!max.text.length;
return arr.to!(string[])
Cookies help us deliver our services. By using our services, you agree to our use of cookies.