We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d4ff039 commit e03e580Copy full SHA for e03e580
04-algrithm/01-table/__tests__/index.spec.js
@@ -0,0 +1,26 @@
1
+const { check, checkMem } = require('../index');
2
+describe('分桌坐 ', () => {
3
+ describe('递归解法', () => {
4
+ it('6人 每桌最少坐2人 4种分法', () => {
5
+ expect(check(6, 2, 10)).toBe(4);
6
+ })
7
+ it('10人 每桌最少坐2人 12种分法', () => {
8
+ expect(check(10, 2, 10)).toBe(12);
9
10
+ it('100人 每桌最少坐2人 437420种分法', () => {
11
+ expect(check(100, 2, 10)).toBe(437420);
12
13
14
+
15
+ describe('递归解法 + 内存化', () => {
16
17
+ expect(checkMem(6, 2, 10)).toBe(4);
18
19
20
+ expect(checkMem(10, 2, 10)).toBe(12);
21
22
23
+ expect(checkMem(100, 2, 10)).toBe(437420);
24
25
26
+})
0 commit comments