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.
.
now, click on the pseudo of the user and guess what happened to him... ;)
Hey pinkston. Here's a demonstration for why you usually don't want to mutate an input array:
You can see that if you change the contents of "randomArray" in your solution, the validator that checks your solution won't be running on the same input. Since you never really know if the test case is made this way or not, it's just safe to assume that it is and keep the original array untouched.
Hope that resolves your confusion! :)
Unless mutating the input is a requirement, never mutate it. In a lot of katas (like this one), the input is passed to your function and after that, it's passed to a control function, so if you mutate it, wrong expected results will appear.
Because you never want to mutate the input unless you definitely know that it won't lead to any unexpected behavior.
Don't mutate the input.
use rather something more appropriate... ;)
do I have to create a custom List class with a modified getitem method?
I really can tell much more without spoiling the solution, read what you have to find in the instructions, think about how are Fibonacci numbers changing and it'll come eventually.
Have you tried with a loop?