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.
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
This comment is hidden because it contains spoiler information about the solution
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.
Didn't know about visualizers. This comment made me look them up and i can already tell theuy're gonna be a huge help. :)
This kata really pushed my skills and took a long time for me to figure out, and I honestly love to see the top solution afterwards is something unrecognizably simpler than what I worked out. Really cool stuff. =)
That's the one!
https://pythontutor.com/python-debugger.html
Loading more items...