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.
The visualizer only executes the first line of the code...
AMAZING!!! I don't know how people are able to think this way.
Coding requires humility. I figure my code will have to be fixed by someone else.
Never would have thought of this, nice.
Elegant way to play around bool.
Got basically the same thing. It's good to know heapq but for a simple logical task it's nice to be able to do it with no library, though I admit I was cringing a bit at my own till[till.index(min(till))], an obviously redundant and costly operation.
I ended up getting almost identical solution in my first try. Feeling super happy, though I believe this can be further optimized like handling case when n=1 and using more optimal structures like heapq.
I didn't think it could be solved with a one-dimensional array, my two-dimensional array gets bad results when using min(), for example res = min([[0, 9, 9], [1, 1]]) after running res = [0, 9, 9]. Because 0 < 1
Added to JS, Java, and Python.
This comment is hidden because it contains spoiler information about the solution
by default will return None nice
While this has many up-votes for best practices, it's worth noting that searching the entire list of queues for every single customer results in a worst case time complexity of
O(nm)
, wheren
is the number of queues andm
is the number of customers. You can achieveO(n log m)
using Python'sheapq
module.Love how simple this is. My ugly code got the job done, but this is artful
Can someone explain me why this works when n = 1?
Most fo the time I don't even understand the top solution. This iste definetly teaches me humility more thna coding.
Loading more items...