Hi.. this is the problem for the Phone Interview in Uber
A jump means adding or subtracting 1.
“Converge” means all the elements get to the same value.
Given an integer array, find if all the elements could converge with 1 jump (or less) and return the converge value.
input elements could be numbers between 0 and 9 inclusive
9 plus 1, gives you 0
0 minus 1, gives you 9
Test Case
[ 1, 0, 9, 9, 1, 1, 0 , 3]
Output = -1
As if you jump down from 1 to 0 on all 1s, and you jump up on all 9 to 0, all numbers are going to converge into 0 value. So your output is the converge value, 0 in this case. Return -1 if there is no convergence like would be the case if in the example we add a “3” at the end (or any other number).