Help to resolve no output
Array-target sum pairs
Hello @Yukta,
-
Assign i=0 before while loop
Reason:
You have altered itβs vale to n in the input loop -
Conditional expression of first for loop inside the while loop is wrong:
Modification:
i<n -
The logic you have applied has higher time complexity and would not account for all cases.
Reason:
For i=0;
inner for loop will iterate from j=0 to j=n-1 and would terminate with j=n
For i=2 to n-1,
inner loop will not execute as j=n
I have modified your code:
Hope, this would help.
Give a like, if you are satisfied.
1 Like