5 kyu
The longest bracket substring in the string
150 of 345myjinxin2015
Loading description...
Puzzles
Performance
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Unexpectedly hard task, like for 5 kyu. I spent two days, before I solved it. Really good job)))
In your example in the details, why is "())(()))" supposed to return 4? That looks like 6 to me ( reduces to "()(())" ). Are double sets (()) not counted as two sets (4 characters)?
I don't know what you mean by "reduces to", but this:
is the longest balanced bracket substring. Whereas
()(())
is not even a substring of the given string.Thanks, I get it now. Boy was I barking up the wrong tree here
Python translation updated with new test framework
Approved.
Rust translation ready for review.
Auto-approved after elapsed grace-period.
nice kata!
hello I am stuck with this kata somehow. Ive got 20 wrong out of 160 tests, and I cannot think of the cases when my code doesnt work. so if possible could you give me more basic tests to work out?
Many linear solutions in python 3 can't pass tests if they aren't exactly the same as referee solution. Micro optimization is evil. I suggest to lower number of tests a little to accept more variations.
I don't know what this means. Sometimes, referee solution's result is wrong? Or..
I think he means a solution which runs in linear time still fails .
Thanks @cliffstamp, that's exactly what I mean.
Due to number of tests, difference between execution time and time limit is very tight - at the moment only one set of instructions pass test suite in Python. However I assume purpose of test suite is to assert that player's solution runs in linear time. So lowering number of tests a bit might be wise to not prevent good solutions to pass tests.
Sounds like an issue to me...
Execution speed should be checked with tests which solutions with bad time complexity cannot pass, not by running lots of tests while imposing tight time limits. Unless it's a micro-optimization task, though the description doesn't says so anywhere.
In fact, the description doesn't even mention the performance requirements of the Python version.
It did mention
performance
requirements for all versions and yes micro-optimization is also an issue in my view but let's hear what myjinxin thinks about it.Reduced the number of testcases in the performance tests to
50
. When I test with the translator's solution, I often get timeouts, too. So, It's obviously too strict with users ;-)Python translation
Please review and approve.
Approved. Thanks O_o