Why isn't this working

sol: https://ide.codingblocks.com/s/382913

problem: https://hack.codingblocks.com/app/contests/1975/195/problem

I know that there are other more efficient solutions but I want to make this one work

Hey @raghav007
You only have to print unique triplets ,for that u have to delete duplicate nos in array.
Also to get the desired results as that of question u also have to sort the array first.
So sort the array and delete duplicates and then apply ur algo.


I have implemented using the n^2 method but only 1 test case is passing

hey @raghav007

			if(sum > target){//target here
				right -= 1;
			}
			else{
				left += 1;
			}

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.