iam getting run error for test case 0 pls help me finding my mistake
Run error in test case 0 array target sum triplet
Check for this test case:
9
5 3 9 1 2 8 6 8 1
10
You will get the error
Take reference from this code:
for the above test case I am getting 1 ,1 and 8 two times which is correct
but for the above code given by you 1,1and 8 is being printed only one time
where is my mistake
we have to print it only one time, that’s why i have give you code for this problem.
Do this and your code will also do the same
if(a[l]+a[h]==k){
cout<<a[p]<<", "<<a[l]<<" and "<<a[h]<<endl;
h--;
l++;//updated
co++;
}
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.