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.
Be aware that the stack space here can become huge for bigints. It's a better practice to use tail recursion for constant stack space.
Given all the corner cases -- and especially the C translation -- this is well beyond a level 7 Kata.
this task does not correspond to the seventh level of difficulty
That's something I didn't know, thanks! It's fixed now :)
white space is a typo of whitespace and doesn't mean what you use it for.
that character's name is space.
tagging as
issue
because it's misleading in a way that isn't relevant to the task (as opposed to clever phrasing), lowers the quality of the problem, and will teach beginners something that is wrong.please remove all occurrences of "white" from the description and tests.
my code in editor is working, but not here
Hey @MikeJH82 and welcome to Codewars - in general, saying that stuff "works on my machine" is covered in the Troubleshooting page , there are lots of reasons why something might seem to work locally but not on CW; the most common being that you haven't tried all possible test cases on your machine, only "basic" ones.
I copied your code vs the tests and it seems that it is failing on inputs of this kind:
s = "L iMiMiMiMiMi R"
your code produces
result = "L R"
with 2 spaces, while expected answer is"L R"
with only 1 space.Indeed the same thing happens with one of the examples from the description:
"1i2 33 i4i5 i555ii5"
for which your code returns"33 55"
with 2 spaces (and here 2 5's also) rather than"33 5"
.For some reason the code I write to remove additional spaces is working in VSCode but not here.
Good point, thanks, let me check it out.
Thank you, Sir!
If the tests in any language do not show the input on failure, raise an
Issue
( specifying the language ). It is always possible, and often easy, to show test inputs on faiure. For low level kata, it's also a good idea.It might be advisable for failure messages to show spaces as underscores, because HTML has a habit of collapsing multiple spaces into one. Also, showing quotes as delimiters make it explicit with how many spaces an input starts or ends.
You could of course print inputs yourself; almost all languages allow that. And you can show spaces as underscores, and quotes, when doing that. But you should not have to.
ETA: printing inputs for succeeding tests, like your JS translation does, is not the correct approach ( it leads to endless clutter ). Inputs should be shown on failure only, and most test frameworks ( including JS's ) facilitate that.
JS translation
Well, after spending one and half day on this kata I can assure you that this is not a 7kyu kata due to its random tests. I mean it fine to write regex expressions and we do it all the time here, but these random tests only break my idea and force me to create a new "thing" to come over it. Is it good? Partly yes, but the reward for this struggling is almost nothing.
As this is a 7 kyu kata, its random tests should provide the wide range of methods to solve it. What do I mean? It should not be like random letters at all, because you canot see the input and you cannot understand what is wrong in your algorithm. So the debugging here is a nightmare due to the fact that random tests are as always closed.
So, not a 7 kyu at all, would probably give it 6 kyu.
This entire Discourse section must be purged!
Loading more items...