Greedy approach proof

Правка en1, от rr459595, 2019-08-06 09:19:10

I solved this problem on hackerrank ( https://www.hackerrank.com/contests/dcl2k15/challenges/mice-v1 ) based on greedy approach. I am not able to understand the proof of the greedy approach.

The proof says max( |a1-b1| , |a2-b2| ) <= max( |a1-b2|, |a2-b1| ) for a1<a2 and b1<b2. Can someone help me in proving the inequality?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский rr459595 2019-08-06 09:19:10 350 Initial revision (published)