Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Had my Rust solution succeed on first submission and then had on a second one choke on the random test input
999999
. This test might catch a lot of faulty solutions and should probably be added to the fixed tests.You need to add a digit only when it's needed, like from 9 to 10 or 99 to 100. In the cases you mentioned, there is no need to add one, only keep the same amount of digits. Not a kata issue.
You expect 'foobar00' to be incremented to 'foobar01', then you expect 'foobar099' to be incremented to 'foobar100'. 'foobaar001' should be incremented to 'foobar002'. Retain '0's in some and lose them in some other cases. Do not randomly design Katas just because you've to. Let there be some logic.
PS: I used Python3
I will say that is a bit to hard for 5 Kyu
Haskell translation
My solution is ugly as hell but it was fun to code it :D
This comment is hidden because it contains spoiler information about the solution
lolol
Your code fails several sample tests. The kata is fine, debug your code and fix it. Not a kata issue. Read the post below too.
'foobar1' should equal 'foobar01'
Make it make sense....... next
Thanks for clarifying ๐
In
'foobar0100' should equal 'foobar100'
the first value is what your function returned, not the input. To see the input, print it.I got
'foobar0100' should equal 'foobar100'
...but shouldn't it be
'foobar0100' should equal 'foobar0101' instead?
"foobar00" turns into "foobar01" because the end result after the string was incremented was 2, which did not take up both digits. If it was "foobar09", then it would turn into "foobar10", because the result now takes up both zeros which were in the input. In the case of "foobar099", 99 turns into 100, meaning it now takes up 3 digits. In "foobar099", there are 3 numbers at the end, so you would not include the extra 0 after incrementation.
Documentation is your best friend too
Loading more items...