Largest int from concatenated ints: Difference between revisions

{{out}}
({{out}})
Line 80:
loop, parse, d, `n
MsgBox % LargestConcatenatedInts(A_LoopField)</lang>
{{out}}
Outputs:<pre>998764543431
6054854654
554454</pre>
Line 156 ⟶ 157:
& out$(str$(maxnum$(54 546 548 60)))
);</lang>
{{out}}
Output:
<pre>998764543431
6054854654</pre>
Line 415 ⟶ 416:
 
{{out}}
 
<pre>[998764543431,6054854654]</pre>
 
Line 487:
=={{header|Java}}==
{{works with|Java|1.5+}}
This example sets up a comparator to order the numbers using <code>Collections.sort</code> as described in method #3 (padding and reverse sorting). It was also necessary to make a join method to meet the output requirements.
It was also necessary to make a join method to meet the output requirements.
<lang java5>import java.util.*;
 
Line 579 ⟶ 580:
}
}</lang>
{{out}}
Output:
<pre>998764543431
6054854654</pre>
Line 626 ⟶ 627:
))
end</lang>
{{out}}
Output:
<pre>Numbers: {1,34,3,98,9,76,45,4}
Largest integer: 998764543431
Line 640 ⟶ 641:
makeLargestInt[{1, 34, 3, 98, 9, 76, 45, 4}]
makeLargestInt[{54, 546, 548, 60}]</lang>
{{Outputout}}
<pre>998764543431
6054854654</pre>
Line 711 ⟶ 712:
echo maxNum(@[1, 34, 3, 98, 9, 76, 45, 4])
echo maxNum(@[54, 546, 548, 60])</lang>
{{out}}
Output:
<pre>998764543431
6054854654</pre>
Line 861 ⟶ 862:
HighestInt(tmpData);
end.</lang>
{{out}}
output
<pre>998764543431
6054854654
Line 872 ⟶ 873:
large([1, 34, 3, 98, 9, 76, 45, 4])
large([54, 546, 548, 60])</lang>
{{out}}
Output:
<pre>%1 = 998764543431
%2 = 6054854654</pre>
Line 934 ⟶ 935:
(flip
(by '((N) (apply circ (chop N))) sort L) ) ) )</lang>
Output{{out}} in all three cases:
<pre>998764543431
6054854654</pre>
Line 992 ⟶ 993:
name(V, LV).
</lang>
{{out}}
Output :
<pre> ?- largest_int_v1([1, 34, 3, 98, 9, 76, 45, 4], Out).
Out = 998764543431.
Line 1,039 ⟶ 1,040:
</lang>
 
{{out}}
Output :
<pre> ?- largest_int_v2([1, 34, 3, 98, 9, 76, 45, 4], Out).
Out = 998764543431 .
Line 1,156 ⟶ 1,157:
end /*j*/
/*stick a fork in it, we're done.*/</lang>
{{out}}
'''output'''
<pre>
998764543431 max for: {1, 34, 3, 98, 9, 76, 45, 4}
Line 1,238 ⟶ 1,239:
maxNum$ = maxNum$ ; a$(j)
next j
end function</lang>Output<pre>Max Num 1, 34, 3, 98, 9, 76, 45, 4 = 998764543431
{{out}}
<pre>Max Num 1, 34, 3, 98, 9, 76, 45, 4 = 998764543431
Max Num 54,546,548,60 = 6054854654</pre>
 
Anonymous user