Dsa
Recursion
Easy
Count Word Combinations
You are given a list of unique words and a target string. Write a function to count the total number of ways to combine the words from the list to form the target string. A word can be used multiple times.
Input Format:
The first line contains space-separated unique words. The second line contains the target string.
Output Format:
An integer denoting the number of combinations to form the target string.
Example:
Input:
app apple applet
apple
Output:
2
Key concepts
recursionstringssearching
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