Recursion _ all indices problem

What are the mistakes in the code?