+ 26

[ ASSIGNMENT: ] Next bigger number with the same digits

TASK : You have to create a function that takes a positive integer number and returns the next bigger number formed by the same digits : For Example :: next_bigger(12) --> return 21 next_bigger(513) --> return 531 next_bigger(2017) --> return 2071 If no bigger number can be composed using those digits, return -1 : next_bigger(9) --> return -1 next_bigger(111) --> return -1 next_bigger(531) --> return -1 HappyCodings!:) https://code.sololearn.com/W2BW1CphwSyR/?ref=app

29th May 2018, 7:47 AM
Danijel Ivanović
Danijel Ivanović - avatar
11 odpowiedzi
+ 18
https://code.sololearn.com/cggjg7OwB881/?ref=app
29th May 2018, 11:38 AM
LukArToDo
LukArToDo - avatar
29th May 2018, 5:55 PM
Rstar
Rstar - avatar
+ 11
I answered this challenge on Codewars : https://code.sololearn.com/cgMtX4sQGKq4/#py
29th May 2018, 2:46 PM
Cépagrave
Cépagrave - avatar
29th May 2018, 8:08 PM
reviiea
reviiea - avatar
+ 7
A little late, but here's a try https://code.sololearn.com/cp9Rj98VU327/?ref=app
20th Jun 2018, 1:20 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 5
31st May 2018, 2:10 PM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 3
Ruby: Bigger & Smaller https://code.sololearn.com/c5rG4A5xT9uG/#rb quite new to oop en inheritance, so probably it could be optimized quite a lot
31st May 2018, 12:03 PM
bedawang
bedawang - avatar
+ 2
I didn't notice about next bigger, so I update my code from next smaller, to have both It use slices, so there is not limit like permutations about digits quantity https://code.sololearn.com/c2WryQgXPPV4/?ref=app
30th May 2018, 4:15 PM
Francisco Casas
Francisco Casas - avatar
+ 2
https://code.sololearn.com/wLX5190Zs0bz/?ref=app https://code.sololearn.com/cWhBW83yu3eF/?ref=app
30th May 2018, 11:44 PM
Johann
Johann - avatar
10th Jul 2018, 9:52 AM
Salman
Salman - avatar
+ 1
My solution, witch uses the build in permutations function: https://code.sololearn.com/c8Ab3cnD2FGR/?ref=app
2nd Jun 2018, 4:10 AM
lemmi
lemmi - avatar