title: Check the building that sees the farthest
body: <p>I'm trying to write a program in assembly that takes an x and y coordinate ,x will act as the position of a building and y will act as its height.
  Now i'm supposed to check the building that sees the farthest.</p>
  
  <p>For example:</p>
  
  <p><a href="https://i.stack.imgur.com/du0M2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/du0M2.png" alt="enter image description here"></a></p>
  
  <p>As you can see in the example the building at position 8 sees 4 meters ,and at position 7 that building sees 2 meters, and at position 9 that building sees 9 meters which is the farthest distance ,so all i have to do now is print that 9 sees 9 meters and its the farthest distance.
  I can't seem to figure out an algorithm to do so.</p>