I don't know how accurate my observation is! But, I think there is a bug in the accepted solutions to this problem. For example, let's see the third example: x1=1, x2=4, t1=0, t2=0. Here they say the answer will be unique and that is 2.5 but the answer can be 2 also! Consider, another example: n=3, x1=1, x2=3, x3=11 and t1=t2=t3=0; The accepted code gives answer: 6 (the meeting point). Analysis: |x1-6|+|x2-6|+|x3-6|=13; But, if we choose 2 as the meeting point, then the absolute sum is: |11-2|+|3-2|+|1-2|=11 which is lesser than 13(the accepted output) Could anyone please help me to understand this concept?
Update: Yes, I have understood the concept. I have to minimize the maximum distance among all distances. Thank You.