Ad
  • Default User Avatar

    I guess it was all said but please find my below comments:
    The description should mention about very large numbers involved as well as
    possibility of empty strings.

    Anyway - this is max Kata 6kyu.

  • Default User Avatar

    Ok, I used another "for" loop instead of recursion and it works :) Yeahhhh!!
    However there is still something I don't get with null return while using resursive call of method.
    In VisualStudio all works but in Codewars editor there is some problem with return of null.

  • Default User Avatar

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

  • Default User Avatar

    Thanks for reply and verification of my code. Sorting is not required - you can read on that in the author's comments in Discourse.
    Duplicates are the problem in my code. I found the issue . I am working hard on loops modification.

  • Default User Avatar

    I guess I found the issue with my algorithm.
    I need to use recursion instead of loops.

  • Default User Avatar

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

  • Default User Avatar

    I need to add that all tests pass till 9173 . Looks like something is wrong with tests for pins of 4 digits and larger.

  • Default User Avatar

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

  • Default User Avatar

    Nice KATA. But the instruction should be more thorough and give some details what should be an output in case of extraordinary inputs e.g. if input string is empty - why the output should contain 2 empty strings instead of three. How can we guess that.
    This should be specified in instruction. The same is concerning two consecutive operations(eatings) e.g. what if we have two bears and they eat the same ( one after the other) - should it be returned one time only (?) or we should treat that as two separate eatings even though they are the same.

    Ufff.. anyway I eventually solved it and the idea of Kata , I must admit, is very nice.
    Cheers!

  • Default User Avatar

    Yes, you are right. I corrected as you said and it works now. But why the hell it worked in VisualStudio. Before the null ss returned the function was recalled so the function should execute anyway. Anyway thanks a lot for assistance.

  • Default User Avatar

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

  • Default User Avatar

    Yes I meant recursion . So that means that in coedwars to pass the tests I cannot use recursion by returning another call to the same function?
    Correct?
    If so I will try to solve this case by adding another loop.

  • Default User Avatar

    Yes, in visual studio I got the correct answer for the test string. In my solution there is a reccurency and the final list is out of the function block but I believe it is not an issue.
    Looks like the codewars test is not working with reccurency , I don't now . I am not so experience with codewars - I have just completed 12 Katas so far but this is the first time I used reccurency.

  • Default User Avatar

    I got following error:
    Test Failed
    Expected: < "fox,bug,chicken,grass,sheep", "chicken eats bug", "fox eats chicken", "sheep eats grass", "fox eats sheep", "fox" >
    But was: null

  • Default User Avatar

    Just forgot to add that I used C#.

  • Loading more items...