Array sum of triplet

what is the problem in my code because it is showing TLE

hi @samyakjain1050_65748654e19948da

cout<<a[i]<<" and "<<a[j]<<" and "<<a[k]<<endl;

u had written this, while o/p is expected in this format-

cout<<a[i]<<", "<<a[j]<<" and "<<a[k]<<endl;

but if u make this change also 4 test cases will pass and 1 will give TLE. for that u will have to optimize ur approach using 2 pointer method…

refer this code -->

what is 2 pointer approach ?

refer the code i shared… u will get better understanding

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.