what condition should I use after line no.16 to avoid repetition of number in output
Arrays-Target Sum Pairs Problem
@Ajitverma1503
Start your inner loop from i+1 i.e. j=i+1.
After this you will not even need the if(i!=j) condition and you will be assured that no pair is counted twice.
1 Like
thank you. got it
hey @Ajitverma1503, you need to print smaller element first and then larger one later.
here is your updated code https://ide.codingblocks.com/s/109091
1 Like
hey @Ajitverma1503 , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved
thank you for modifying my code