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.
This is the pattern of the dynamic programming
Awesome code using dynamic programming
Very good!
guys how if the total time is 14.67 walking 1km for 10 minutes + taxi 4.67 for the remaining in this case
print(calculate_optimal_fare(8, 10, 90, 2, 6))
whish any one can help me understand it
-12 + (-18) = -30; the target is '6 - (-12) = 18' or '6 - (-18) = 24';
There is quite good solution, but it isn't consider values such as:
So, 6 can be found by (-12 - -18) for example...
Practice. Don't listen to negative responses.
no bro :(
Your problem comes from the concept of proximity. The description says that we sould return the pair with the lowest last element's index. It means that in [10, 5, 2, 3, 7, 5] the answer is [3,7]. In [10, 5, 2, 3, 5, 7] the answer is [5,5] because the last 5 has an index lower than 7.
Yes, your code is even faster than mine
Btw I check the performance on jsbench.me, it's a great site
hi, try my mine please, I think I achieved the best speed result
Perfect solution
If you see what I have been trying to do in 3 days, you will advice me to quit.
Well, this one is more inspiring. For the kata, the algorithm complexity of solution can not be reduced. However this trick is somehow better than doing int comparison (as I once did), let alone adding up two numbers each time. On the other hand, utilizing the set type also involves consideration of the feature of python language, which is good.
shorter not always better 🙂
Loading more items...