Largest int from concatenated ints: Difference between revisions

Add Nimrod
(Updated D entry)
(Add Nimrod)
Line 629:
6054854654 : 54,546,548,60
</pre>
 
=={{header|Nimrod}}==
<lang nimrod>import algorithm, sequtils, strutils, future
 
proc maxNum(x: seq[int]): string =
var c = x.mapIt(string, $it)
c.sort((x, y) => cmp(y&x, x&y))
c.join()
 
echo maxNum(@[1, 34, 3, 98, 9, 76, 45, 4])
echo maxNum(@[54, 546, 548, 60])</lang>
Output:
<pre>998764543431
6054854654</pre>
 
=={{header|OCaml}}==
Anonymous user