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.
Memoization via a stream isn't good enough to solve this kata. You'll have to study the link provided in the description.
This comment is hidden because it contains spoiler information about the solution
I tried it and it failed in two of the test cases (I think where one array was empty and the other was null)
group() without parameter corresponds to all the characters matching the regex pattern. Group(1) corresponds to the group 1 in the regex pattern.
With the string
abc-def
and the regex pattern.-(.)
group() returnsc-d
and group(1) returnsd
This comment is hidden because it contains spoiler information about the solution
(?m) multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
The StackOverflow most probably suggests the approach is not the best one. The "max buffer size reached" might be possible to fix, depends what causes it: https://docs.codewars.com/training/troubleshooting/#maxbuffer
Both can be also caused by some bug putting you in an infinite recursion/loop by mistake.
You need to find a way to perform fewer recursive calls. Making one recursive call per term is going to exhaust stack quite quickly if there's many terms. There are algorithms to calculate Fibonacci numbers which require significantly fewer steps, be it iterative, or recursive.
Yes, your solution needs to return the exact value.
Which is, actually, not that much. If my back of envelope calculations are correct, millionth fib is ~90kB. This volume of data should be possible to handle without serious problems. Getting to the result, on the other hand, this is the actual challenge.
It's perfectly fine to use recursion in this problem.
Please read the description.
Not a problem, that input is not in the problem's domain.
I do mean LinkedList, and if it's slow it's possible it's still not used by you correctly. It can be difficult to tell without seeing your code.
But I did not try to solve the kata with LinkedList so I dont guarantee it 100% works. I would expect it to, but I went with a math approach for my solution.
This algorithm might work, but you need a better data structure. Removing from an
ArrayList
is relatively expensive, there are collections which will suit this task better.Or you can research for a math approach, but I think yours should work too, just takes much more memory than math one.
This comment is hidden because it contains spoiler information about the solution
Loading more items...