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 only works cause uses a named return type. If his variable would be called sum1 it would return nothing.
Python doesn't have arrays and the code above isn't creating a list either. It's creating a generator and the creation specifically takes almost no resource, since the values are generated lazily.
AFAIK the difference comes from the code above calling isdigit function a lot of times, whereas replace is only called 10 times. Keep in mind, that both of the functions are highly optimized and written in C, so that's why the the code with more function calls and more python is slower. That also for example causes some O(n^2) algorithms to run faster in python, than an O(n log n) alternative.
I think the assumption is only broken pipes would be passed to the function.
Then again, he doesn't use an unnecessary list comprehension
The result can be a float but nowhere does it say the input will be a float
This comment is hidden because it contains spoiler information about the solution
For example when one char takes 2 bytes or more.
For example, Russian letter "Ш" takes 2 bytes.
It same for chinese hieroglyphs
hmmmmmmmmmmmmmmmmmm
Hey I'm newer to Go and would like to learn more about this. When would the byte count vs char count be different using
len()
?The difference between your solution is huge because the list of all numbers is computed only once.
The whole solution is not run for each test on codewars - it runs only once and calls the solution function multiple times
Bc creatin new array is more time and resource consuming. Using regex is BP for this case. My advise for everyone: learn what is regix (import re) and how to use it
This comment is hidden because it contains spoiler information about the solution
If there were additional conditions, there would be other requirements, other tests and another solution. If you have a "brilliant" idea, then make another kata and tests yourself.
You simply justify yourself
This comment is hidden because it contains spoiler information about the solution
Loading more items...