Google-Developer-Student-Club-CCOEW / Competitive-Coding

7 stars 53 forks source link

Question 43 #80

Open Mahi1901 opened 1 year ago

Mahi1901 commented 1 year ago

Vikram and Anay are at positions X and Y on a number line.They both love badminton.It is known that badminton courts are located at every integer point.They want to find a court such that the maximum distance traveled by either of them is minimized.Formally, suppose they choose the badminton court at position Z. You need to find the minimum value of max(∣X−Z∣,∣Y−Z∣) across all possible choices of Z. Here, |X| denotes absolute value of X. Output this minimum value.

Constraints 1≤T≤1000 1≤X,Y≤1000 X=Y

Sample 1: Input 4 3 5 7 6 1 10 63 31 Output 1 1 5 16

Explanation: Test case 1: They will choose the court at position 4 in the optimal case where both have to travel a distance of 1 unit.

Test case 2: They can either choose the court at position 6 or position 7. In both cases one person has to travel a distance of 1 unit.

Ris-code commented 1 year ago

Hey,can you assign me this

NikitaMiraje commented 1 year ago

Nikita Rajendra Miraje Cummins College Of Engineering For Women, Pune dept- Electronics And Telecommunication can you plz assign this issue to me??

Ris-code commented 1 year ago

Hey,can you assign me this

IIT Jodhpur B.Tech Artificial Intelligence and Data Science 2nd Year

Mahi1901 commented 1 year ago

I have assigned. Happy coding!

NikitaMiraje commented 1 year ago

@Mahi1901....can you assign me this issue???