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.
fixed in latest fork
Approved
python new test framework is required. updated in this fork
In Python, the random tests only sometimes include any test that returns
False
, allowing an incorrect code submission to pass.In Python, the parameter overwrites the module name
string
.Awsome kata, thanks for putting it together.
Very cool!
.
Python 3 should be enabled.
Thanks for this kata, challenged me and I learned something new in Python :)
No.
thanx for this kata, very helpful for interpreters
hope u make other good katas
I don't think that the runtime can be significantly improved. The algorithm is already linear with respect to the size of the input string and unless there are restrictions on the nesting, number of brackets, ... every char needs to be processed.
So the only room for improvement would be to minimize the number of operations needed for each char. As far as I know python lists are optimized for fast append() and pop(), so no possible improvement for the stack. The remaining code seems pretty optimal. Looking at your solution the only 'obvious' improvement (since this is a python2 kata) would be to replace range with xrange, but in my tests
range
,xrange
andenumerate
all have a similar runtime. The differences are much smaller than the differences due to the load on the codewars servers. So for compatibility with python3 I would stick withrange
.It seems everyone so far has the same solution, which takes over 3 seconds to run. Is there a better method to do this problem?
Be my guest literally suggesting a rewording, then :)
Loading more items...