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.
If the next small gift is beyond the specified distance from the current gift, but still closer to your home base than the nearest gift on the opposite side, proceed to collect it.
a is at a distance of 3.
b and z are at a distance of 7.
So z is beyond the 2*3=6 max distance.
And z is not closer to the base than b.
But the test expects us to grab it as well since the expected result is
zab
Am I missing something?
This comment is hidden because it contains spoiler information about the solution
I wanted to do it without using string :D
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
To simplify, I just prepare a list of prime numbers instead of checking every integer.
That's pretty much it.
Indeed, I really got too used to lazy_static.
True, self.juices should be emptied if everything is poured out (amount >= self.amount).
Maybe that's just me but I have no idea what's asked.
Ah, hence the inline.
I was wondering what it was for, thanks :)
I guess the compiler automatically changes 21**n in the result.
The total of the resulting list doesn't really adds up to 360, just close to it.
The tests sometimes throw an exception:
I cheated and bypassed the kata security to use the random module. :)
2*n == n*2
Yours seems slightly faster indeed, but around 10-20% depending on the size of the list.
And partly because of the extra layer of itemgetter.
For example with the same random tests as the kata and the same list of 1_000_000 tests for each one, I get the following results:
Mercy: 3.399389314651489 seconds
Oleg: 3.032890796661377 seconds
rowcased: 3.238804864883423 seconds
And while obviously not unreadable, your code takes just a little longer to get for a newcomer.
This comment is hidden because it contains spoiler information about the solution
Loading more items...