Write a function, ‘nearest_larger(arr, i)’ which takes an array and an index. The function should return another index, `j`: this should satisfy:
(a) `arr[i] < arr[j]`, AND
(b) there is no `j2` closer to `i` than `j` where `arr[i] < arr[j2]`.
In case of ties (see example below), choose the earliest (left-most) of the two indices. If no number in `arr` is larger than `arr[i]`, return `nil`.
Must pass these test cases:
The important thing to remember here is that we should initialize the starting point at the given index since we’re comparing left and right simultaneously (because they are at equivalent distance to the index). Also set the bounds for left and right respectively.