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.
I agree with you, I've just wanted to show that it doesn't have enough test cases. So it's a normal bug in the Kata:)
I think this solution is not correct.
It does not (properly) check whether the elements of sys are coprime.
Instead it just checks if sys contains more than one even number - which is just a special case.
The solution would for example fail to return "Not applicable" for [3, 6].
Well, I can open you a secret. For calcating the amount of method execution I use a subclass where I have just overriden the reverse method. How would you count the same using a static merhod? Any good idea?
I did the kata before the question just was wondering why it doesn't work in that way. I've found the same problem in another kata. Please don't mind, I guess it's a minor issue with static fields out the method as you've already said.
The recursive function should be stateless.
I guess you have a side effect as u use global variables.
Try to find mode examples about recursive funcitons and how they supposed to work.
ok, let me double check it
But if you run the code in intelij, you can see that count is 11 and code works correctly with the reverese for strings.
I've added count for print.
Hi Danials,
It means only one thing that your code is wrong. Please try to spot an error in your code.
Unfortunately I did a mistake when put expect result instead actual and can't change it now as all tests are blocked.
You should read it as: expected 11, but was 8.
Sorry for the confusion with static (just forgot to remove when copied from my intellij), please remove it and run it again and you will see that tests can't check the code properly.
It shows hello world expected:8 but was:11
Hi ChristianECooper,
May I ask you to provide your solution to be able to check it.
All tests are generalized and workable, but please make a note that if you have a string with len() = 0 then function would be called 1 time.
@CIS, thank you for your assistane.
The tests appear to count how many times reverse is recursively called. Make sure your edge case is when len(str) <= 1.
You should always spoiler your code on these discussions, since they can be viewed inadvertantly by someone who hasn't solved the kata yet.
Your reverse method should not be static. Just use public String reverse(String str). That should get you past the compiler error.
This comment is hidden because it contains spoiler information about the solution