Searching in an array where adjacent differ by at most k
A step array is an array of integers where each element has a difference of at most k with its neighbor. Given a key x, we need to find the index value of x if multiple-element exist to return the first occurrence of the key.Examples: Input : arr[] = {4, 5, 6, 7, 6} k = 1 x = 6 Output : 2 The first index of 6 is 2. Input : arr[] = {20, 40, 50, 70,