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.
That's an implementation detail I was relying on. Since that string's reference counter is 1, the add-assign operator could try to add to the existing string (while the add operator cannot do that, as the assignment comes later).
Well, it used to be more efficient.
I just did a
timeit.timeit
on Python 3.8.5 (on very long strings, a billion characters), and the add first then assign version was same for short strings, about twice as fast for longer strings. Which is the opposite of what I expected.Maybe I did my previous tests on Python 2.7, quite possible. Interesting, I never thought that part would change. Or my tests back then were wrong (I was still relatively new to Python).
(My own solution does use a generator expression instead of a list, but pretty much agree on the overall design)
This comment is hidden because it contains spoiler information about the solution
Not sure what you mean, if 111 represents a dot rather than dash, how do you explain the seven zeroes?
Insufficient tests, obviously, this code should not pass. Fails on
d01(0, 0)
and ond01(1, 3)
, for example.Please add the word "regular" to the polygon. Imagine a non-regular polygon, for example a rectangle of 6x8 in a circle of radius 5. It has area 48, but you expect value 50 from a square.
That's because it's not square root, but cubic root of
1*2*6
(as those are three numbers).This comment is hidden because it contains spoiler information about the solution
The test cases are lacking a test for the first line
[[2,5], [3,6]] is NOT the same as [[2,3], [5,6]]
. Some solutions flatten the array for convenience and would not pass this test, yet they do while violating the very first of the numbered rules.Another thing that is not tested are duplicates. Different solutions have different opinions on whether
same([[1,2],[1,2],[3,4]],[[1,2],[3,4],[3,4]])
should evaluate to true or not.This comment is hidden because it contains spoiler information about the solution
That code does not like words consisting of Ts only (haven't seen them in the wild, yet they could be possible).
'1110001110000000111' is clearly 'TT T', but the code converts it to morse code '..0.' and finally to ''
For the solution with every, [undefined].sameStructureAs([[1,[2]]]) returns true while [[1,[2]]].sameStructureAs([undefined]) returns false.
Maybe this is a very exotic test case, but I like the idea of a.sameStructureAs(b)==b.sameStructureAs(a), which is violated here.