--- title: Combinations id: 5958469238c0d8d2632f46db challengeType: 5 videoUrl: '' localeTitle: Комбинации --- ## Description
Задача:

Учитывая неотрицательные целые числа m и n , генерируйте все размерные m комбинаций целых чисел от 0 (ноль) до n-1 в отсортированном порядке (каждая комбинация сортируется и вся таблица сортируется).

Пример:

3 гребня 5 :

 0 1 2
0 1 3
0 1 4
0 2 3
0 2 4
0 3 4
1 2 3
1 2 4
1 3 4
2 3 4
## Instructions
## Tests
```yml tests: - text: combinations - это функция. testString: 'assert(typeof combinations === "function", "combinations is a function.");' - text: 'combinations(3, 5) должны возвращать [[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]] .' testString: 'assert.deepEqual(combinations(testInput1[0], testInput1[1]), testOutput1, "combinations(3, 5) should return [[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]].");' - text: 'combinations(4, 6) должны возвращать [[0,1,2,3], [0,1,2,4], [0,1,2,5], [0,1,3,4], [0,1,3,5], [0,1,4,5], [0,2,3,4], [0,2,3,5], [0,2,4,5], [0,3,4,5], [1,2,3,4], [1,2,3,5], [1,2,4,5], [1,3,4,5], [2,3,4,5]]' testString: 'assert.deepEqual(combinations(testInput2[0], testInput2[1]), testOutput2, "combinations(4, 6) should return [[0,1,2,3], [0,1,2,4], [0,1,2,5], [0,1,3,4], [0,1,3,5], [0,1,4,5], [0,2,3,4], [0,2,3,5], [0,2,4,5], [0,3,4,5], [1,2,3,4], [1,2,3,5], [1,2,4,5], [1,3,4,5], [2,3,4,5]]");' ```
## Challenge Seed
```js function combinations (m, n) { // Good luck! return true; } ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```