mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-07-07 18:10:24 +08:00
Add more tests.
This commit is contained in:
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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.
|
||||||
|
Reference in New Issue
Block a user