LeetCode
Maximum Distance in Arrays
Click
here
for an explanation.