Anonymous user
Largest int from concatenated ints: Difference between revisions
<lang julia></lang>
(<lang julia></lang>) |
(<lang julia></lang>) |
||
Line 1,148:
=={{header|Julia}}==
Perhaps algorithm 3 is more efficient, but algorithm 2 is decent and very easy to implement in Julia. So this solution uses algorithm 2.
<lang Julia>
b = map(string, a)
b = join(b, "")
try
b = parseint(b)
catch
b = parseint(BigInt, b)
end
end
tests =
[54, 546, 548, 60],
[1, 34, 3, 98, 9, 76, 45, 4, 54, 546, 548, 60]
for
println("
println(" ", maxconcat(t))
{{out}}
<pre>
Maxconcating [1,34,3,98,9,76,45,4]
Maxconcating [54,546,548,60]
</pre>
=={{header|Kotlin}}==
|