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.
The answer is simple: it does not.
I am both delighted and frustrated by this kata after completing it in Python.
I am glad I found one fast solution myself and a number of slow ones.
I am glad that I learnt that in Python positive and negative power notations have dramatically different performance, that Py integers do not have precision and that things like float128 are platform-dependent fiction.
I am glad that I have gone through numPy docs and now understand what it is and how to use it (and even solved with it), as well as that even numPy may have a super-counterintuitive location of a seemingly super-necessary functionality.
And I am terribly frustrated that in the end I see the solutions out there that just should not be passing by timeout, it's basically my slow code ignoring all the above, which I just cannot explain.
Very enlightening task.
I do not mar it as spoiler, though this one has some hints.
Why is this not being upvoted? IMO the cleanest and the most straightforward to understand.
Oh yes I know why. Because someone wrote a bedsheet of code above and nobody scrolls here :)
It should be "...else x-2 * y...". or "for c in roman.reverse()"
I suggest to have the "bad source" with unmatched brackets in tests. That way the
[
and]
operations processing would be tested for not going out of the code bounds. I feel that my current solution would fail this way.Because if 1 OP is 1 cycle, by jumping PAST you are saving 1 cycle, otherwise wasted.
Doesn't counting the positions of brackets make this more a compiler than an interpreter? :)
Wait, you are creating a new StringBuilder EACH TIME you are flipping the bit? This solution deserves a special un-optimization reward.
I did somewhat similar, but this can be simplified, since
tempWord.Remove()
returns bool. So you could essentially foreach(){if!Remove => NOPE}This comment is hidden because it contains spoiler information about the solution