can you please elaborate the question like we have to cover all the coordinates in that area or we have to find area between two coordinates than compare to get max one
Not able to understand the question
Hi @Rajat-Sharma-2078329489142103
In this problem you will be given points by user. For each point entire row and column will be considered as river. Now you have to find the max area present between the rivers.
In the image you can see that grey colour row and column represents the river and now to have to code accordingly so as to find the max area present. ( which is the white area present in the image )
All we need to do is just store all the X and Y coordinates and then sort them. Then we will calculate maximum ΔX and ΔY where ΔX = (Xi -Xi-1) & ΔY = (Yi -Yi-1). Then the area will be (ΔY-1)*(ΔX-1).
In your code you have taken a pair in which you are sorting it according to x co-ordinate. But you have to take 2 separate arrays for x and y co-ordinates and then sort them and then calculate the max area using the above formula.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.