All indices problem

please help me understand how to approach this all indices problem using the recursive method.
the solution in the editorial is present I am finding a bit difficult to understand this.

@neelmani98 hey ,here is recursive approach please try it:
Recursive approach :

  • If the start index reaches the length of the array, then return empty array
  • Else keep the first element of the array with yourself and pass the rest of the array to recursion.
    • If the element at start index is not equal to x then just simply return the answer which came from recursion.
    • Else if the element at start index is equal to x then shift the elements of the array (which is the answer of recursion) one step to the right and then put the start index in the front of the array (which came through recursion)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.