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.
Got it, thanks.
I need an O(1) algorithm.
Measured the search for numbers with n = Integer.MAX_VALUE:
Using stream() → 2.5 seconds
Using for loop → 1.7 seconds
How much faster do you want it to be?
n = Integer.MAX_VALUE = 2147483647
Variant : IntStream() -> count is : 1073741823, was counted in 2551 milliseconds.
Variant : for -> count is : 1073741823, was counted in 1718 milliseconds.
As someone who teaches introductory CS concepts, I love this question. Thanks!
Find a faster algorithm. Not a kata issue.
IntStream() and For() make "Time Out"
cool
That's the spirit
suggested tag:
performance
Your array is too long, and it's causing that error.
Fatal error in , line 0
Fatal JavaScript invalid size error 169220804
#FailureMessage Object: 0x7ffdb53b0180
1: 0xbd7061 [node]
2: 0x1dfa6b4 V8_Fatal(char const*, ...) [node]
3: 0xeeb3a8 [node]
4: 0x10992f2 [node]
5: 0x10995b2 [node]
6: 0x12a813b v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [node]
7: 0x16e99f9 [node]
i got the error like this. Why this is not work. i test this is passed and work.
any solution?
i use javascript
Approved
OP solved it, closing
performance tag is still missing :[
I was frustrated by the timeout like others were (PHP), and had to look around for performant answers. Like someone said, once solved, you will smack yourself on the head for how simple your thinking needed to be.
Good kata just for that lesson.
I tried in javascript methods slice, splice with the for loop, while loop, but i have the same TimeOut (12000 ms). What's wrong?
Loading more items...