title: Find the highest distance in vector
body: <p>I have an array of positive integers. The problem is to find the highest 
  distance in vector. The Distance is calculated as A[p] + A[q] + (q - p), where A is a vector p, q are indexes and p&lt;=q. The complexity of the solution must be O(n). I'm able to solve this problem with a O(n^2) solution, but I can't find a O(n) algorithm for this problem.</p>
  
  <p>Someone could help me? Thanks in advance. Which language is used to find the solution doesn't matter</p>