Find number of steps required to reach a target element

Question :-

Given -

  1. array with n integers whose elements are populated with [0, n-1]
  2. all the elements in the array are unique ( no repetition )
  3. elements are arranged in random order

required -

  1. to find number of steps to reach a target element

example - array - [5, 1, 0, 4, 2, 3] value - 3 the function func(array, value) should return 4

index - 0 1 2 3 4 5
array - 5 1 0 4 2 3
array[3] = 4
array[4] = 2
array[2] = 0
array[0] = 5
array[5] = 3 --- target found, total 4 steps to reach here

function signature

def func(array, value):
"""
array - int array
value - int
return - int
"""

constraints-

  • cannot use length of array
  • after computation the array should remain same
  • cannot add parameters to the function
  • cannot use global/static variables
  • cannot use while, do, for, goto [can use if]
  • cannot use a subroutine, should only be the the function mentioned above

This question is simple without the constraints, can i get some help to better understand how i can do this?