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.
While negative powers do exist, as it is written it's hard to think they are even possible:
How would you mutiply some number by itself a negative number of times?
And what about negative power (p < 0)?
not working when first rune is not a byte
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.
Then again, he doesn't use an unnecessary list comprehension
pretty much the same thing as mine... not bad!
The result can be a float but nowhere does it say the input will be a float
This is a multilingual solution! +1
Nice 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
Loading more items...