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.
You're asking programmers to not explain why bad code is bad.
Coding requires humility. I figure my code will have to be fixed by someone else.
I initially thoght of this solution, but used the count method of a list. Yours is better to be honest.
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.
This comment is hidden because it contains spoiler information about the solution
i like how every comment is just "this is not best practice!!!"
guys, chill
The count method is called for each unique character in the text, leading to an overall time complexity of š(šā š)
O(nā m), where n is the length of the text and š is the number of unique characters. This can be inefficient for large texts.
This comment is hidden because it contains spoiler information about the solution
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.
Loading more items...