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.
yeah i did this too sorta forgot that .replace existed
I thought the same as you, "What is the point of using already existing functions?". But it depends on what level you are in, if you are a beginner it is much useful and beneficial to do it from scratch, but if you have more experience you don't have to.
Why not? If you have a function from THE STANDARD LIBRARY that can help you solve the problem, why would you create it from scratch?
nice !!
That's not how it works!!!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Hence it's very slow. sorted + arr.count applied to every element of array.
This is a frequent solution for more complicated strings
What actually happens when you don't provide a default label?
nice solution
Hey I learned this today too! 3 years later though...
I think it goes like this: key=arr.count applies this to each element of array, so as it goes through sorted array its value will be 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 on each element (arr.count(12) == 2 and so on...), so max() returns first element that has the highest count, which in sorted array is 7. Docs state that: "If multiple items are maximal, the function returns the first one encountered." For example, if array was not sorted and switched 6 and 7, like [12, 12, 10, 10, 10, 6, 6 ,6 ,6, 7, 7, 7, 7] then it would return 6, since its the first element with highest count. Hope this clears it up.
"Don't reinvent the wheel" :-)
This comment is hidden because it contains spoiler information about the solution
Loading more items...