Given an array of integers arr, you start at index 0. In one step you can jump from index i to i + 1, to i - 1, or to any index j != i with arr[j] == arr[i], as long as you stay inside the array. Return the minimum number of steps to reach the last index.
Given an array of integers arr, you start at index 0. In one step you can jump from index i to i + 1, to i - 1, or to any index j != i with arr[j] == arr[i], as long as you stay inside the array. Return the minimum number of steps to reach the last index.