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.
Are the tests timing out? This kata can be solved without recursion and modification of the original array.
This solution is too slow and probably times out. Values of r in excess of 1 million are used in tests. Modifying the original array will not work. Need to figure the array index for any given r. I solved it by writing out the results for R from 1 to 35 and looking at the sequence. It has something to do with powers of 2.
Needs test cases