Return Largest possible number from a list of non-negative integers. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Return Largest possible number from a list of non-negative integers.

Write a function that takes a list of non-negative integers, sorts them so that they make up the largest possible number. For example, [50, 2, 1, 9], the largest generated number is 95021, or [9, 988, 9, 9] => 999988. Task from https://proglib.io/p/5-problems-for-software-engineer/

11th Sep 2017, 4:22 AM
Daniel Ustavshchikov
Daniel Ustavshchikov - avatar
6 Answers
+ 2
my one, tested with 5,51,516 https://code.sololearn.com/W12S8c8hCH97/?ref=app note: past challenges help to new challenges :)
11th Sep 2017, 2:58 PM
ysraelcon
ysraelcon - avatar
11th Sep 2017, 4:42 AM
sayan chandra
sayan chandra - avatar
+ 1
@sayan looks good but I think you wanted the output to be original list --> sorted list rather than sorted list --> sorted list (?)
11th Sep 2017, 5:47 AM
David Ashton
David Ashton - avatar
0
@sayan it does not work for [5,51,516]
11th Sep 2017, 6:41 AM
yuri
0
this challenge has been proposed earlier. i would grateful if someone can find test case when my code does not work https://code.sololearn.com/cZ24Q62ArDRS/?ref=app
11th Sep 2017, 6:44 AM
yuri
- 1
@@ david.. given list-->sorted list such that it forms biggest number-->joined list... my output is very clear...
11th Sep 2017, 7:36 AM
sayan chandra
sayan chandra - avatar