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.
Genralized tip:
You'll fail all the test, but usually you'll see the input. (Except, as you'll discover here, not always.)
Often this will help you find out the count of tests. (Although, again not always.)
I was able to reach 65 tests, but still timed out. I suspect we're using the same algorithm (but I've optimized mine as much as possible). I have in mind another algorithm which I think may be faster, but don't have time to implement it at the moment. I'd encourage you to try a different approach. 232 people have solved it in Python, so it should be doable.
No spoilers, sorry. :)
Funny solving this one...
Since the SecurityManager is deprecated since Java 17 and permanently deactivated since Java 24 this kata likely doesn't have a chance to ever be working again in upcoming Java versions.
You could do that, and then also add random tests on top.
reopening because
PHP
closing
fork provided for JS
EDIT: temporarily unpublished to fix refSol
SECOND EDIT: okay, it's now ready to be vetted
in C: random tests don't excite all paths in solution, allowing incorrect code to pass all tests.
Some cases not covered by default:
but others might also be missing. You can try to find them by running tests 10+ times.
fixed
fixed
hi there!
my code passed 55 (example + short), but T.O in large ones.
running python.
already O(log n), and not sure how to reduce it further.
was it tested using python on servers? can it get better than O(log n)?
edit:
on my 6y.o laptop i get 50 tests of 106-digits in split of a second:
number: 1234567890123456789111111111111111111111111111111111112345678901234567891111111111111111111111111111111111 size: 350 array: [1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1]
Action took 0.00 seconds
how big are the big numbers?
The representation with the shortest length of "digits" (1 or -1).
What does "the least" mean??
Random tests added in C, C++, Java, and JavaScript.
approved
Loading more items...