no output is coming while it is showing success.
Arrays --target sum triplets
Hello @2001jainrupesh,
There are two problems in your code:
-
The logic inside for loop is executing only once for single each value of i. But, there is no profit, if the inner statements would not execute for while(left<right) .
Your code is not returning any value because as per your logic there is no such triplets which sums upto 10 for given testcase. -
Even if you’ll correct the first condition, your code would not print the right output. This is because you are printing the index and you are required to print the elements.
I am sharing the modified code.
But, i would highly suggest you to first try to correct your code yourself.
Click here only if you are stuck really bad.
Hope, this would help.
Give a like, if you are satisfied.
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.