Arrays-Target Sum Pairs

MY 3 TESTCASES ARE WORKING BUT I AM NOT ABLE TO PASS THE FOURTH ONE.
PLEASE SUGGEST ME ANY POSSIBLE CASE WHICH I MIGHT FORGET TO CONSIDER IN MY PROGRAM .
ONE THING MORE , IN THIS QUESTION IS THERE A POSSIBILITY OF ANY DUPLICATE VALUE AS THIS CONSTRAINT IS NOT MENTIONED NEITHER IN THE QUESTION NOR IN THE EXAMPLE. AND IF THIS THE CASE THEN PLEASE SUGGEST ME AN EASY WAY TO FRAME IT .

there are no duplicates…just sort the array and the apply your logic…share the code if problem persists…

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.