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
global
ignore case
Well, one call to match is performed in O(N) and you cannot solve the problem faster.
But it also allocates extra O(N) memory only to take the length of the array[-ish structure] later.
TIME = O(N), optimal
MEM = O(N), non-optimal, O(1) is possible.
This comment is hidden because it contains spoiler information about the solution
That's 2 to the power of 19
One doesn't need to use built-in
toString
method because the problem cannot be solved with direct computation anyway. Some (school level) math knowedge is required.Use
radix
or_base
its cool to come 3 years later and complain about version.
10 years ago I was also saving each extra loop iteration, making code better as I thought. That's called premature optimiztion and highload is about scalability rather than constant time factor.
"VOL." is still a problem in JavaScript.
It uses
Uint8Array
which is low-level machine array.That's what was used in Doom (yes, original Doom 1). Instead of calculating sin/cos they had a table.
Overall code isn't production-grade, but nice use of tail recursion.
Actually the thing is it cannot be solved w/o some math.
Knowing math, there's not much of a programming here, thoug—I agree on that.
This comment is hidden because it contains spoiler information about the solution
Loading more items...