Array target sum triplet

My solution is working fine for sample case , but i am unable to pass the test case . i can’t figure out what happened

here is the code:

While printing give separation between comma and number and “and” and number.

ohh :sweat_smile: thanks!