mishrasamiksha / Arrays_Target_Sum_Triplet

Take as input N, the size of array. Take N more inputs and store that in an array. Take as input “target”, a number. Write a function which prints all triplets of numbers which sum to target. Input Format: First line contains input N. Next N lines contains the elements of array and N+1 line contains target number. Constraints: Length of Array should be between 1 and 1000. Output Format: Print all the triplet present in the array. Sample Input: 9 5 7 9 1 2 4 6 8 3 10 Sample Output: 1, 2 and 7 1, 3 and 6 1, 4 and 5 2, 3 and 5 Explanation: Array = {5, 7, 9, 1, 2, 4, 6 ,8 ,3}. Target number = 10. Find any three number in the given array which sum to target number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mishrasamiksha/Arrays_Target_Sum_Triplet Watchers