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.
Either call yourself twice, or use
function
syntax. Tests want to see"fibonacci"
twice. ( Yes, anti-cheat is hard to do well. )Marked resolved.
You have global variable arr1, and you just keep pushing values into it on 2nd function call. So on second call you get 2nd lowest and 2nd highest (pop and shift) from two test cases combined.
And yes, using global variable like that makes no sense.
Read this: https://docs.codewars.com/training/troubleshooting#.print-vs-return