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 comment is hidden because it contains spoiler information about the solution
a and b are just grid dimensions. It's completely arbitrary which one might represent the number of rows and which one for columns.
It does define x and y in the description.
In the Python version, the test code gives a list of tuples as argument, not a list of lists as in the instructions. Also the function name is different than in the instructions.
This comment is hidden because it contains spoiler information about the solution
Not sure it's worth importing for that single use.
630ms still seems like a long time. My solution is repeatedly under 75ms. I notice that your solution, like many others, creates an extra array. You are also summing the list, then substracting from that sum. Best to work through the list backwards, summing as you go with each iteration. And then just removing the list items that aren't leaders - this makes for less manipulation of the string.
I know these test cases were rather small arrays, but I wonder if it is less computationally demanding to declare the flipped array as seperate variable, so as not having to flip it for each loop.
Both clear and concise. I like it. Now I just need to remember some of those practices for my own coding.
Ah, OK so it creates a dictionary with a count for each letter that appears in the string. Yes, that would be faster for long strings. Thanks.
Is there a reason to import this Counter instead of using the built-in count method for strings?
Why?
Is there a special prize I don't know about for one line answers?
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
Loading more items...