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 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.
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.
This comment is hidden because it contains spoiler information about the solution
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.
I guess I found the issue with my algorithm.
I need to use recursion instead of loops.
This comment is hidden because it contains spoiler information about the solution
I need to add that all tests pass till 9173 . Looks like something is wrong with tests for pins of 4 digits and larger.
This comment is hidden because it contains spoiler information about the solution
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!
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.
This comment is hidden because it contains spoiler information about the solution
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.
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.
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
Just forgot to add that I used C#.
Loading more items...