Skip to content

Commit e73aabf

Browse files
authored
Added tests 416-543
1 parent 2af7490 commit e73aabf

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// tslint:disable:no-magic-numbers
2+
import { canPartition } from 'src/main/ts/g0401_0500/s0416_partition_equal_subset_sum/solution'
3+
import { expect, test } from 'vitest'
4+
5+
test('canPartition', () => {
6+
expect(canPartition([1, 5, 11, 5])).toEqual(true)
7+
})
8+
9+
test('canPartition2', () => {
10+
expect(canPartition([1, 2, 3, 5])).toEqual(false)
11+
})
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// tslint:disable:no-magic-numbers
2+
import { createTreeNode } from 'src/main/ts/com_github_leetcode/treenode'
3+
import { pathSum } from 'src/main/ts/g0401_0500/s0437_path_sum_iii/solution'
4+
import { expect, test } from 'vitest'
5+
6+
test('pathSum', () => {
7+
expect(pathSum(createTreeNode([10, 5, -3, 3, 2, null, 11, 3, -2, null, 1]), 8)).toEqual(3)
8+
})
9+
10+
test('pathSum2', () => {
11+
expect(pathSum(createTreeNode([5, 4, 8, 11, null, 13, 4, 7, 2, null, null, 5, 1]), 22)).toEqual(3)
12+
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// tslint:disable:no-magic-numbers
2+
import { findAnagrams } from 'src/main/ts/g0401_0500/s0438_find_all_anagrams_in_a_string/solution'
3+
import { expect, test } from 'vitest'
4+
5+
test('findAnagrams', () => {
6+
expect(findAnagrams('cbaebabacd', 'abc')).toEqual([0, 6])
7+
})
8+
9+
test('findAnagrams2', () => {
10+
expect(findAnagrams('abab', 'ab')).toEqual([0, 1, 2])
11+
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// tslint:disable:no-magic-numbers
2+
import { findTargetSumWays } from 'src/main/ts/g0401_0500/s0494_target_sum/solution'
3+
import { expect, test } from 'vitest'
4+
5+
test('findTargetSumWays', () => {
6+
expect(findTargetSumWays([1, 1, 1, 1, 1], 3)).toEqual(5)
7+
})
8+
9+
test('findTargetSumWays2', () => {
10+
expect(findTargetSumWays([1], 1)).toEqual(1)
11+
})
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// tslint:disable:no-magic-numbers
2+
import { createTreeNode } from 'src/main/ts/com_github_leetcode/treenode'
3+
import { diameterOfBinaryTree } from 'src/main/ts/g0501_0600/s0543_diameter_of_binary_tree/solution'
4+
import { expect, test } from 'vitest'
5+
6+
test('diameterOfBinaryTree', () => {
7+
expect(diameterOfBinaryTree(createTreeNode([1, 2, 3, 4, 5]))).toEqual(3)
8+
})
9+
10+
test('diameterOfBinaryTree2', () => {
11+
expect(diameterOfBinaryTree(createTreeNode([1, 2]))).toEqual(1)
12+
})

0 commit comments

Comments
 (0)