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.
Approved
Done Rust translation, please approve: https://www.codewars.com/kumite/650f00c4b838490012d37b5c?sel=650f00c4b838490012d37b5c
This one was so hard for being a yellow kata you have no idea, because it's all about dynamic programming and optimizing, so I'd rank it up, really funny, yet more complex than challenging.
Very cool kata, thanks so much!
This comment is hidden because it contains spoiler information about the solution
No worries; and my apologies - I rudely forgot to say thanks for the nice kata before raising the Issue, so thanks!
Fixed!, Thanks for your help!
Language : C++
There is a problem with 1 (and only 1) of the fixed tests in the
Hidden Test Cases
:This test case ends with the chars
')
- i.e. chars which are not>
<
or.
- this was probably an accident while pasting the string from another language version where strings are terminated with'
.I don't think it's deliberate/intended to be a test case for input validation (invalid chars) because such tests don't appear in the other language I have solved (Python) and isn't mentioned in Description.
This was fun. Thanks!
Thanks for the approval!
Hello. you have a nested for loop so that makes the complexity of your function O(n^2). Try to iterate over the string once or twice and think what you need to calculate during each step.
Thanks for the translation!
Lua translation!
This comment is hidden because it contains spoiler information about the solution
Hi - to answer your question, even though you only have 1 "visible"
for
loop, you are actually performing a lot more "loops" inside your code:The
.count(".")
function, each time you call it, is looping through the entire list (or at least a significant fraction of the list => all the elements after indexchar_list[i:]
) which means that your solution is closer to beingO( n * n)
because for each of then
elements in thefor
loop, you are then doing anotherapprox ~ n
operations each time you use thecount
method.You're very close to a faster solution though, so I won't spoil too much - think about what you do and do not need to calculate at each step of your for loop.
Loading more items...