[ ASSIGNMENT: ] Form The Largest | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 23

[ ASSIGNMENT: ] Form The Largest

TASK : Given a number,  Return The Maximum number could be formed from the digits of the number given. NOTE : - Only Positve numbers passed to the method, numbers Contain digits [1:9] inclusive! - Digit Duplications could occur, So also  consider it when forming the Largest. For Example :: 1. maxNumber(213) --> return (321) Explanation : As 321 is The Maximum number could be formed from the digits of the number 213. 2. maxNumber(7389) --> return (9873) Explanation : As 9873 is The Maximum number could be formed from the digits of the number 7389. 3. maxNumber(63729) --> return (97632) Explanation : As 97632 is The Maximum number could be formed from the digits of the number 63729. HappyCodings!:-) https://code.sololearn.com/WB2MAg0h7qW4/?ref=app

22nd May 2018, 5:40 PM
Danijel Ivanović
Danijel Ivanović - avatar
12 Answers
+ 25
https://code.sololearn.com/ciOg5nlq2b6C/?ref=app
14th Jul 2018, 3:25 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 14
https://code.sololearn.com/c4E8xd6vM7QJ/?ref=app
23rd May 2018, 5:33 AM
LukArToDo
LukArToDo - avatar
+ 8
# Python # I think this will do work 👇 print("".join(sorted(input())[::-1]))
22nd May 2018, 8:40 PM
Zoetic_Zeel
Zoetic_Zeel - avatar
20th Jun 2018, 2:13 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 7
https://code.sololearn.com/cxl40Ran3TLE/?ref=app
23rd May 2018, 9:16 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 4
If you use text conversion and ignore the non zero rule it is obvious. Here is a solution forbthe less obvious case https://code.sololearn.com/c4G0StU6vJ3q/?ref=app
22nd May 2018, 7:22 PM
VcC
VcC - avatar
+ 4
Well this works what was exactly told in the assignment Python :- print("".join(reversed(sorted(input()))))
23rd May 2018, 7:10 AM
Salman
Salman - avatar
23rd May 2018, 1:20 PM
michal
+ 3
Ruby: p gets.chomp.split('').sort.reverse.join('').to_i
23rd May 2018, 12:32 PM
bedawang
bedawang - avatar
24th May 2018, 3:58 AM
lemmi
lemmi - avatar