Ad
  • Default User Avatar

    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:)

  • Custom User Avatar

    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].

  • Custom User Avatar

    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?

  • Default User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    ok, let me double check it

  • Default User Avatar

    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.

  • Custom User Avatar

    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.

  • Default User Avatar

    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

  • Custom User Avatar

    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.

  • Default User Avatar

    The tests appear to count how many times reverse is recursively called. Make sure your edge case is when len(str) <= 1.

  • Default User Avatar

    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.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution