Problem
Input format
The program reads from standard input two natural numbers, `n` and `k`, separated by a space. - `1 <= k <= n <= 8`
Output format
The program prints all combinations, one per line. On each line the elements are written in strictly ascending order, separated by spaces, with no trailing space. Combinations must be printed in lexicographic order.
Example
4 2
1 2 1 3 1 4 2 3 2 4 3 4
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
4 2
1 2 1 3 1 4 2 3 2 4 3 4
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.