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.
And what does your solution return in your IDE for
incrementString("foobar000")
?testing's ok, the problem is that it fails on the examples on codewars but when i test the same examples in ide it works just fine
If your code fails on Codewars but seems to work in your IDE, it usually does not mean that the code is correct. It means that you are testing it in the IDE incorrectly.
count the zeroes in both strings.
Try to run it in a normal compiler in an IDE, it will and it does run correctly - so the code is in fact correct.
issue
tag to ask for help, ask aquestion
insteadThis comment is hidden because it contains spoiler information about the solution
You should not convert the stringified result derived from the regex group to integer, because it will truncate leading zeros, giving the wrong results. Not a kata issue nonetheless.
This comment is hidden because it contains spoiler information about the solution
fixed
This comment is hidden because it contains spoiler information about the solution
Your solution has a bug, it crashes for inputs like
"foobar999"
. It is not a kata issue.This comment is hidden because it contains spoiler information about the solution
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.
Loading more items...