Dsa
Backtracking
Warm-up
Path to Target Sum
Given an array of integers and a target integer, write a program to find all unique combinations in the array that add up to the target sum. Each number in the array can only be used once in each combination. The combinations should be returned in ascending order, and each number in the combination should be printed in a single line. If no combination exists, print 'No Combination'.
Example:
Input:
4
10 1 2 7 6 1 5
8
Output:
1 1 6
1 2 5
2 6
1 7
Key concepts
backtrackingsubset sumrecursion
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now