The TransCompilator

Solved LeetCode program · 77 of 1,000

#0077 · Combinations

Medium Backtracking chunk-02.md

Original English source

Keep a shared size of 4. Keep a shared choose of 2. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.
To combine from index (a whole number) with depth (a whole number). If depth is choose, The built is join parts with ",", Place built into answers, then return. If index is more than size, return.
For every value from index to size.
The piece is format whole number value as text. Place piece into parts. Combine from value plus 1 with depth plus 1. Remove the last item from parts.

Combine from 1 with 0. For each answer in answers, report answer.

Open in Playground Browse all 1,000 problems

Expected stdout

1,2
1,3
1,4
2,3
2,4
3,4