Add more tests.

This commit is contained in:
Oleksii Trekhleb 2018-06-08 16:54:07 +03:00
parent d5a8b1e8d5
commit 9de6bc7de3
2 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,9 @@ describe('integerPartition', () => {
expect(integerPartition(2)).toBe(2); expect(integerPartition(2)).toBe(2);
expect(integerPartition(3)).toBe(3); expect(integerPartition(3)).toBe(3);
expect(integerPartition(4)).toBe(5); expect(integerPartition(4)).toBe(5);
expect(integerPartition(5)).toBe(7);
expect(integerPartition(6)).toBe(11);
expect(integerPartition(7)).toBe(15);
expect(integerPartition(8)).toBe(22); expect(integerPartition(8)).toBe(22);
}); });
}); });

View File

@ -1,5 +1,6 @@
/** /**
* @param {Number} number * @param {number} number
* @return {number}
*/ */
export default function integerPartition(number) { export default function integerPartition(number) {
// Create partition matrix for solving this task using Dynamic Programming. // Create partition matrix for solving this task using Dynamic Programming.