Anonymous user
Largest int from concatenated ints: Difference between revisions
Slight layout change in task description. (No new info).
(→{{header|Python}}: This also shows one of the few times where cmp= is better than key= on sorted()) |
(Slight layout change in task description. (No new info).) |
||
Line 1:
{{draft task}}
Given a set of positive integers, the task is to write a function to order the integers in such a way that the concatenation of the numbers forms the largest possible integer and return this
Use the following two sets of integers as tests and show your program output here.
Line 7:
* {54, 546, 548, 60}
;Possible algorithms:
# A solution could be found by trying all combinations and return the best.
# Yet another way to solve this is to pad ints to the same size by repeating the digits then sort using these repeated ints as a sort key.
Cf:
|