Anonymous user
Largest int from concatenated ints: Difference between revisions
Largest int from concatenated ints (view source)
Revision as of 17:01, 3 February 2021
, 3 years agoUpdated to work with version 1.4 of Nim.
(Updated to work with version 1.4 of Nim.) |
|||
Line 1,293:
=={{header|Nim}}==
<lang nim>import algorithm, sequtils, strutils,
proc maxNum(x: seq[int]): string =
var c = x.mapIt(
c.sort((x, y) => cmp(y&x, x&y))
c.join()
Line 1,302:
echo maxNum(@[1, 34, 3, 98, 9, 76, 45, 4])
echo maxNum(@[54, 546, 548, 60])</lang>
{{out}}
<pre>998764543431
|