Question bank › Recursion
Dsa Recursion Hard

Subsequence Combination Sum

Given a list of integers and a target integer, write a program that finds all unique combinations of the integers in the list that sum up to the target integer. Each number in the input list can be used on multiple occasions in the combination. The combinations should be printed in ascending order. The input consists of the first line containing an integer n (1 ≤ n ≤ 30), followed by n integers (1 ≤ num ≤ 50) on the second line representing the numbers in the list. The last line contains the target integer t (1 ≤ t ≤ 200). Print all unique combinations, with each combination on a new line. The combinations should be sorted in ascending order, and the order of combinations does not matter. Example: Input: 5 1 2 3 4 5 5 Output: 1 1 1 1 1 1 1 1 2 1 1 3 1 2 2 1 4 2 3 5

Key concepts

recursionbacktrackingcombinatorics

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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.