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.
thanks!
Time for using lower: 1.2828872501850128
Time for using in: 1.0886021964251995
I ran the tests a few times, and it seems using in is more time effective, but the difference is negligible.
is using name[0].lower()=="r" more efficient than using name[0] in "Rr" ?
good idea !
Is it O(n²) complexity or am I wrong ?
good idea, this would reduce the complexity a little
this is good, I've never thought about resetting index
I think so too, almost. but i think it should be 'if i > 0: i -= 1'.
You are right, then just need to add an
if
or use themax
function to have a lower bound.makes sense, but if the first thing is does is remove the very first pair of directions, then indexing would get all messed up
Because when you remove two items ,it can only affects the surrouding items (old left and old right). While here they start searching from the beginning of the list.
For example if you have
N, N, N, N, E, W, S
when you delete E and W you dont need to go to the beginning but at the last N which was the left of the removed items.Why?
Why?
Shouldn't this fail on the North, East, South, West example mentioned in the explanation?
This comment is hidden because it contains spoiler information about the solution
ohhh! case insensitive!
Loading more items...