+ 4
Challenge here!
Write an algorithm to split an integer Condition: Should not convert int to string Should not use directly split() methods. Ex: Input - > 23542 Output - > 2 3 5 4 2 ALL LANGUAGES ACCEPTED. Here is mine.. https://code.sololearn.com/cBj7Oq4hRZ18/?ref=app
9 Answers
+ 11
Ok, I rethought this and it seems I have overdone this. Here's an amended version:
https://code.sololearn.com/c6CsrGrv1lwu/?ref=app
+ 9
https://code.sololearn.com/colXG17vlX5J/?ref=app
+ 8
My take:
(without math module, as I'd need math.log10 to be more efficient)
https://code.sololearn.com/cNerBN17z032/?ref=app
+ 7
Didn't do any str operations ..
https://code.sololearn.com/Wj53fkUyQ2dF/?ref=app
+ 3
@Gao XiangShuai Yep. Everything should be numerically done. No characters, no strings, only integers.
+ 2
does converting the int to char array count as cheating? :D
+ 2
My own code
https://code.sololearn.com/Wwp9ymoJiwxv/#html
+ 2
https://code.sololearn.com/cQm5pa4FxqJY