Grand temple didn;t pass test case
@Faizan-Ali-1395131367301898
Your code is giving wrong answer even for the sample test case:
3
1 1
2 4
5 2
Expected Output:
2
Your Output:
6
Please check your logic once.
i cant understand the logic,largest area between coordinates is 6
@Faizan-Ali-1395131367301898 The answer should not be 6.Consider the below diagram. Shade boxes corresponding to (1,1), (2,4), (5,2) horizontally and vertically. Clearly, largest area enclosed within shaded boxes is 2.

didn’t pass one test case
Your code is giving time limit exceeded for test case 2. Try to optimize it and solve without using the nested loop.
i am not able to optimize the code please help me