|
| 1 | +import { longestIncreasingSubsequence } from '../LongestIncreasingSubsequence' |
| 2 | + |
| 3 | +describe('Testing longestIncreasingSubsequence', () => { |
| 4 | + it.each([ |
| 5 | + [[], 0], |
| 6 | + [[1], 1], |
| 7 | + [[2, 2], 1], |
| 8 | + [[3, 3, 3], 1], |
| 9 | + [[4, 4, 4, 4], 1], |
| 10 | + [[1, 2], 2], |
| 11 | + [[1, 2, 2, 2, 2], 2], |
| 12 | + [[1, 0, 2], 2], |
| 13 | + [[1, 10, 2, 30], 3], |
| 14 | + [[5, 8, 3, 7, 9, 1], 3], |
| 15 | + [[10, 9, 2, 5, 3, 7, 101, 18], 4], |
| 16 | + [[10, 10, 9, 9, 2, 2, 5, 5, 3, 3, 7, 7, 101, 101, 18, 18], 4], |
| 17 | + [[0, 1, 0, 3, 2, 3], 4], |
| 18 | + [[1, 1, 2, 2, 2], 2], |
| 19 | + [[1, 1, 2, 2, 2, 3, 3, 3, 3], 3], |
| 20 | + [[0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], 6] |
| 21 | + ])('check with %j', (input, expected) => { |
| 22 | + expect(longestIncreasingSubsequence(input)).toBe(expected) |
| 23 | + }) |
| 24 | +}) |
0 commit comments