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.
I've solved it and the solution is the same as the others.
But the solution is not accepted. it took 12 seconds to execute and so it is not accepted
i'm sad
While trying to solve: "Wow, this is a lot harder than I thought"
After solving, looking at the top-solution: "Oh, yeah, alright..."
Approved
Lua translation!
Already mentioned here.
You do not need recursion. A simple for-loop that tracks the last 3 elements' summation of the list will do.
OP solved it, closing. But next time do not modify the input, it is bad practice.
Based on your code:
Now,
oldArray
is the first number of the given input.Meanwhile, you are writing this:
Hence,
undefined
because you cannot access indexing or positioning from a number literal, they are neither arrays nor strings.Your code returns the first n + 3 elements of the needed sequence.
Also, your code fails when
n = 1
andn = 2
I've tested your code and it passed at 5.5 second interval, closing.
Not a kata issue. Your code fails at this line
for the case below ~~
Obviously, trying to access index 18 from [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] is impossible ^^
The pair is not in sequential order, you would have to find them yourself, as written below...
No longer an issue.
But not the next biggest number to 2071
Testing for 4977764433221000 (No brute force solutions 🙃)
God damn it :D
Loading more items...