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.
as you wish
no, otherwise they cannot see the answer. And that doesn't give away the actual solution.
(marked as spoiler :-)
note, you're doing a dfs. That cannot work here.
you can try, but I think you have something else that is causing a loss of time. An actual brute force passes the tests in like 4-6s, iirc.
No it didn't work by brute force, but I'm close, it timeouts after 80% of completion. What I am doing is converting the string to an array because it's more convenient to work with and this takes time. Perhaps if I work directly in the string, I could win some performance enough to pass the tests?
you can brute force it.
This comment is hidden because it contains spoiler information about the solution
Hey guys I am solving this problem without the use of dynamic problem. This kata needs a fix since no dynamic programming is required and it is tagged as dynamic programming.
This approach scan an array three times in
includes
,
filterand
some`.check my approach which scan just two times.
https://www.codewars.com/kata/reviews/538abed5e62c874e1b0000f5/groups/6480cf7d45a05700012deaa9
That matrix is part of the test suit. Not relevant for the solution.
a and b are nodes, so yes, that's all you need to find the path (or not).
how is suppossed to have access to the matrix of connections? with just 'a' and 'b' should we get the result?
at this moment the top solution is that by fengma1992. But it makes use of a simple aritmetic operations which in my opinion is cheating. The problem is tagged as 'graph theory', so something close to that is done in my solution since we do a search of diferent paths to find is there is one that cacth the mouse.
This comment is hidden because it contains spoiler information about the solution
And what is the complexity of solving with recursion than solving with a loop such as my soluction? I think this approach is shorter in code but memory complexity is O(n). using a loop solution memory complexity is O(1)
Loading more items...