+ 13

CHALLENGE: Permutation of digits 💻⌨️🖱️

Level: easy Initial number n is an integer greater than 0. Try to rearrange the digits of the initial number so that the new number is divisible by inital number (the new number contains exactly the same digits as the initial number, but in a different order) . For example: Input: 100035 Output: Possible (300105) 300105/10035=3 Input: 102345 Output: Impossible NOTE: ✔️ Use any language. 🚫 Don't use: String, char or char array. https://code.sololearn.com/cuzywif8t9r7/?ref=app

20th Nov 2017, 10:45 AM
LukArToDo
LukArToDo - avatar
8 odpowiedzi
+ 1
https://code.sololearn.com/cneNRX712MWQ/?ref=app
21st Nov 2017, 2:09 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 3
trying
20th Nov 2017, 12:41 PM
SAKSHI
SAKSHI - avatar
+ 3
I couldn't work out a way in python in which I wouldn't have to use a string if I gave an input. But here is my try with input. https://code.sololearn.com/c3l5QqWibfXh/?ref=app
21st Nov 2017, 5:29 PM
Murillo Pyaia Alves Paixão
Murillo Pyaia Alves Paixão - avatar
+ 1
Good, I work.
21st Nov 2017, 5:18 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
21st Nov 2017, 8:03 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
For digits, I replaced the dictionary with the list and removed the check for presence in it - it seems to me that this should work faster. Для цифр заменил словарь на список и убрал проверку на присутствие в нём - мне кажется, что так должно работать быстрее. https://code.sololearn.com/csdrXhOC6hCR/?ref=app
22nd Nov 2017, 6:34 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
I deliberately refused to go through all the permutations of the digits, since for large numbers this is too slow.
22nd Nov 2017, 6:58 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
22nd Nov 2017, 4:47 PM
Hiroki Masuda
Hiroki Masuda - avatar