it is giving wa on leetcode
Help me out in this problem
yeah checking wait …
Hey I think u are assuming diff is always positive ,correct me if I am wrong 
So its not working because three elements cant have the same index, i.e i ,j and mid should be different but ur code is not taking care of that
@Kartikkhariwal1 bro two for loop then third one i am implementing binary search in such a way that required difference is close to it
Take this outside loops
int mn=INT_MAX;
I think this is self explanatory 
???/
urs is O(n^2 log n) u can do it in O(n^2) ,see the solutions page of the question .