As the question says that only unique triplets are supposed to print my code passes all the test cases but if i account for a test case like
5
5 5 5 5 5
15
output:
5 , 5 and 5
5, 5 and 5
5, 5 and 5
5 , 5 and 5
Arrays Target sum Triplets
Hi,
You can store your triplet in set<pair<pair<in,int>,int> > . since set contains unique elements, so you will get unique triplets.
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.