You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
411 B

4 years ago
## Sums
### Instructions
Create a function named `sums` that accepts a number and returns its partitions.
A partition is a group of numbers, where the sum of the partition is equal to the number argument.
Duplicate partitions are not allowed. `[1, 2]` and `[2, 1]` are considered duplicates.
The array of partitions must be sorted.
4 years ago
Example:
```js
sums(4) // [ [1, 1, 1, 1], [1, 1, 2], [1, 3], [2, 2] ]
```