Largest int from concatenated ints: Difference between revisions
→{{header|Oforth}}
(→{{header|Oforth}}: Bad solution, removing) |
|||
Line 727:
# icsort [54;546;548;60];;
- : string = "6054854654"
</pre>
=={{header|Oforth}}==
<lang Oforth>func: largestInt { map(#asString) sortWith(#[ dup2 + asInteger tor swap + asInteger > ]) sum asInteger }</lang>
{{out}}
<pre>
[ [1, 34, 3, 98, 9, 76, 45, 4], [54, 546, 548, 60] ] map(#largestInt) println
[998764543431, 6054854654]
</pre>
|