Write tests for splitInteger
function that takes 2 positive integers value
and numberOfParts
and returns an array containing exactly numberOfParts
integer elements.
- The difference between the max and min number in the array should be <= 1
- The array should be sorted ascending (from lowest to highest)
You don't need to validate arguments (they are always valid).
Examples:
splitInteger(8, 1) === [8]
splitInteger(6, 2) === [3, 3]
splitInteger(17, 4) === [4, 4, 4, 5]
splitInteger(32, 6) === [5, 5, 5, 5, 6, 6]
Read more about Jest expectations