Question bank › Math
Dsa Math Hard

Combination Sum

You are given an integer K and a list of N integers. Find how many different combinations of the integers sum up to K. Each integer can be used multiple times. Input Format: The first line contains an integer K (1 <= K <= 50). The second line contains an integer N (1 <= N <= 30). The next line contains N space-separated integers (1 <= integers <= 20). Output Format: Print the number of combinations that sum to K. Example: Input: 5 3 1 2 3 Output: 5

Key concepts

mathcombinatoricssum

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