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.
Same bro
Wow! In one line of code! How pythonic!
This solution is incorrect. Distances are calculated as hotel→A, hotel→B, hotel→C, but they should be calculated as hotel→A→B→C→hotel. Am I missing something? How did this solution pass the tests?
Artistic answer, nice :D
Thank you for your answer!
I've tested it <10 ** 600 in range(10 ** 50, 10 ** 5000)> and the result is indeed immediate.
Even complex testing like 648484651561684848484884145316 in range(10 ** 5, 10 ** 4000, 135876).
I'm pretty surprised by this behaviour, which could lead to bad habits in other languages.
The information is not easy to find, thank you for the insight!
This is optimized in python 3.2 and above. This pattern specifically checks the bounds of the range and the step value and calculates mathematically whether a member falls inside the range. In your example, in python 3.2 or above, both calculations take exactly the same amount of time, both have a time and memory complexity of O(1)
You should never look for a number in a range, it's really cpu consuming, specially with large numbers.
Try to compare the computations for :
This comment is hidden because it contains spoiler information about the solution
good!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
nice :)
Same. I wrote up an ugly if..else condition only to realize to see this solution pop up.
Beautiful
Loading more items...