Timeline for Next bigger number with the same digits
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 2, 2016 at 14:21 | comment | added | Jaime |
@gardenhead Yes, you are absolutely right. That little change also takes care of @mrakosms IndexError . As for the reversing, I like slice syntax a lot, and would prefer something like digits[idx:][::-1] , although your proposal is perfectly fine.
|
|
Jan 2, 2016 at 14:18 | history | edited | Jaime | CC BY-SA 3.0 |
added 61 characters in body
|
Jan 2, 2016 at 11:39 | vote | accept | mrakosms | ||
Jan 2, 2016 at 11:43 | |||||
Jan 2, 2016 at 10:30 | comment | added | mrakosms | Thanks, but in line 10 is IndexError. | |
Jan 2, 2016 at 6:10 | comment | added | gardenhead |
I believe that should be idx >= 1 in line 4. Also, mightdigits[idx:] = reversed(digits[idx:]) be cleaner? (I am not a Python style expert).
|
|
Jan 2, 2016 at 4:35 | history | answered | Jaime | CC BY-SA 3.0 |