A code review tool picks k reviewers from a team of n people, numbered 1 to n. The order inside a team doesn't matter.
Write reviewerTeams(n, k) that returns every possible team. Write each team sorted ascending, and list the teams in sorted order: compare first members, then second members, and so on.
Input: n = 4, k = 2 Output: [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
There are C(4, 2) = 6 pairs, listed from smallest to largest.
Input: n = 1, k = 1 Output: [[1]]
One person, one team.
1 <= n <= 101 <= k <= nRun tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #302 Choose K Reviewers. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.