|
| 1 | +import btJumpGame from '../btJumpGame'; |
| 2 | + |
| 3 | +describe('btJumpGame', () => { |
| 4 | + it('should solve Jump Game problem in backtracking manner', () => { |
| 5 | + expect(btJumpGame([1, 0])).toBeTruthy(); |
| 6 | + expect(btJumpGame([100, 0])).toBeTruthy(); |
| 7 | + expect(btJumpGame([2, 3, 1, 1, 4])).toBeTruthy(); |
| 8 | + expect(btJumpGame([1, 1, 1, 1, 1])).toBeTruthy(); |
| 9 | + expect(btJumpGame([1, 1, 1, 10, 1])).toBeTruthy(); |
| 10 | + expect(btJumpGame([1, 5, 2, 1, 0, 2, 0])).toBeTruthy(); |
| 11 | + |
| 12 | + expect(btJumpGame([1, 0, 1])).toBeFalsy(); |
| 13 | + expect(btJumpGame([3, 2, 1, 0, 4])).toBeFalsy(); |
| 14 | + expect(btJumpGame([0, 0, 0, 0, 0])).toBeFalsy(); |
| 15 | + expect(btJumpGame([5, 4, 3, 2, 1, 0, 0])).toBeFalsy(); |
| 16 | + }); |
| 17 | +}); |
0 commit comments