Loading...
Loading...
Loading...
A manager has n employees numbered 1 to n and must pick a team of k. Print every possible team as the numbers in increasing order, and list the teams in dictionary order.
Example
Input
4 2
Output
1 2 1 3 1 4 2 3 2 4 3 4
Six teams.
Try the problem first. Open one hint at a time.
Use a start index so a number is only chosen after the previous one.
When the path has k numbers, print it. Loop from the start index up to n.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor