Question bank › Backtracking
Dsa Backtracking Warm-up

Unique Word Combinations

Given a list of words, generate all possible unique combinations that can be formed by selecting each word exactly once. The order of the words in a combination does not matter, but the output should be sorted lexicographically. Each combination should be output on a new line. Input: The input consists of a single line containing a space-separated list of words. Output: The output should contain each unique combination of words, sorted lexicographically, each on a new line. Example: Input: apple banana cherry Output: apple banana cherry apple cherry banana banana apple cherry banana cherry apple cherry apple banana cherry banana apple

Key concepts

backtrackingstringscombinations

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.