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.
so clean
Nice, I tried to do something similar. Unnecesary generalization ftw
Took me many time-out fails trying to write a general, subsetSum dynamic programming-type solution before I went back to read the question more carefully and realized that the marbles values were always [1..6]
It's just O(n) in an already best case O(n) solution isn't it?
I don't think I was mutating the input, but what you did did clear up the issue I was having. Thank you!
haskellscript
I feel like there might be a problem with the randomized JS tests. My code passes all the fixed tests, but it fails most of the random tests. However, my answers in these cases match an independent recursive function solver I found online. For example, for:
generalizedFibonacchi([4,-2], [-1,-1], 92103), the randomized test expects -2, but my function and the online function produce 4
generalizedFibonacchi([-2,4,3], [-1,1,1], 26624) expects -66557, my function/the online function produce 66558
It could be that we independently implemented the same wrong algorithms, but I think it's worth checking out because when I solve small examples of these recurrence relations by hand, the results I get match up with what is produced by my algorithm as well.
I was really confused about the issues I was having but this (first tip) solved it. Do you know why it is necessary to pull fields out of the class? Does the node version of codewars not support static class fields or something like that?
I like it. I didn't even know functions could be object values
You will need an O(n) solution rather than O(n^2) in order for the code to meet the 12 second deadline for the large values of n in the 'Attempt' test suite. Also, 'a' and 'b should always be distinct values, so I think you might have an uncaught bug right now too.
when I understood what was happening I was really impressed. So cool
think that's the point
good time complexity on this one, think it's optimal
If we're in a wub, keep it moving, maybe drop a space. Othewise we need to copy a song char. I see what you're doing ther bud