Getting a WA in this question

@aryan_007
When you encounter the base case ,
if(j==n2)
then instead of INT_MAX, return 1e15. This would fix the issue. The problem might have arisen because INT_MAX must have been less than the answer of the question. 1e15 shall work fine.

If my answer is able to clear your query, please mark the doubt as resolved.

Still getting all WA

@aryan_007
Please sort the arrays before making the function call. This step is crucial to the algorithm. This is because a small value in the first array must be paired up with a relatively close value in the second array and this result is obtained after sorting the two arrays.

If my answer is able to clear your query, please mark the doubt as resolved.

still getting WA

okay okay got the mistake thanks