Skip to content

Commit fe6a6fd

Browse files
authored
Added tasks 206-238
1 parent 603db53 commit fe6a6fd

File tree

36 files changed

+1001
-6
lines changed

36 files changed

+1001
-6
lines changed

LeetCodeNet.Tests/G0101_0200/S0102_binary_tree_level_order_traversal/SolutionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace LeetCodeNet.G0101_0200.S0102_binary_tree_level_order_traversal {
22

33
using Xunit;
4-
using Com_github_leetcode;
4+
using LeetCodeNet.Com_github_leetcode;
55

66
public class SolutionTest {
77
[Fact]

LeetCodeNet.Tests/G0101_0200/S0104_maximum_depth_of_binary_tree/SolutionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace LeetCodeNet.G0101_0200.S0104_maximum_depth_of_binary_tree {
22

33
using Xunit;
4-
using Com_github_leetcode;
4+
using LeetCodeNet.Com_github_leetcode;
55

66
public class SolutionTest {
77
[Fact]

LeetCodeNet.Tests/G0101_0200/S0124_binary_tree_maximum_path_sum/SolutionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace LeetCodeNet.G0101_0200.S0124_binary_tree_maximum_path_sum {
22

33
using Xunit;
4-
using Com_github_leetcode;
4+
using LeetCodeNet.Com_github_leetcode;
55

66
public class SolutionTest {
77
[Fact]

LeetCodeNet.Tests/G0101_0200/S0142_linked_list_cycle_ii/SolutionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void DetectCycle2() {
2525
[Fact]
2626
public void DetectCycle3() {
2727
ListNode listNode1 = new ListNode(1);
28-
Assert.Equal(null, new Solution().DetectCycle(listNode1));
28+
Assert.Null(new Solution().DetectCycle(listNode1));
2929
}
3030
}
3131
}

LeetCodeNet.Tests/G0101_0200/S0148_sort_list/SolutionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void SortList2() {
2525

2626
[Fact]
2727
public void SortList3() {
28-
Assert.Equal(null, new Solution().SortList(null));
28+
Assert.Null(new Solution().SortList(null));
2929
}
3030
}
3131
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace LeetCodeNet.G0201_0300.S0206_reverse_linked_list {
2+
3+
using Xunit;
4+
using LeetCodeNet.Com_github_leetcode;
5+
6+
public class SolutionTest {
7+
[Fact]
8+
public void ReverseList() {
9+
ListNode headActual = new ListNode(1);
10+
headActual.next = new ListNode(2);
11+
headActual.next.next = new ListNode(3);
12+
headActual.next.next.next = new ListNode(4);
13+
headActual.next.next.next.next = new ListNode(5);
14+
Assert.Equal("5, 4, 3, 2, 1", new Solution().ReverseList(headActual).ToString());
15+
}
16+
17+
[Fact]
18+
public void ReverseList2() {
19+
ListNode headActual = new ListNode(1);
20+
headActual.next = new ListNode(2);
21+
Assert.Equal("2, 1", new Solution().ReverseList(headActual).ToString());
22+
}
23+
24+
[Fact]
25+
public void ReverseList3() {
26+
Assert.Null(new Solution().ReverseList(null));
27+
}
28+
}
29+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace LeetCodeNet.G0201_0300.S0207_course_schedule {
2+
3+
using Xunit;
4+
5+
public class SolutionTest {
6+
[Fact]
7+
public void CanFinish() {
8+
Assert.True(new Solution().CanFinish(2, new int[][] { new int[] { 1, 0 } }));
9+
}
10+
11+
[Fact]
12+
public void CanFinish2() {
13+
Assert.False(new Solution().CanFinish(2, new int[][] { new int[] { 1, 0 }, new int[] { 0, 1 } }));
14+
}
15+
}
16+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace LeetCodeNet.G0201_0300.S0208_implement_trie_prefix_tree {
2+
3+
using Xunit;
4+
5+
public class TrieTest {
6+
[Fact]
7+
public void Trie() {
8+
Trie trie = new Trie();
9+
trie.Insert("apple");
10+
// return True
11+
Assert.True(trie.Search("apple"));
12+
// return False
13+
Assert.False(trie.Search("app"));
14+
// return True
15+
Assert.True(trie.StartsWith("app"));
16+
trie.Insert("app");
17+
// return True
18+
Assert.True(trie.Search("app"));
19+
}
20+
}
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace LeetCodeNet.G0201_0300.S0215_kth_largest_element_in_an_array {
2+
3+
using Xunit;
4+
5+
public class SolutionTest {
6+
[Fact]
7+
public void FindKthLargest() {
8+
Assert.Equal(5, new Solution().FindKthLargest(new int[] { 3, 2, 1, 5, 6, 4 }, 2));
9+
}
10+
11+
[Fact]
12+
public void FindKthLargest2() {
13+
Assert.Equal(4, new Solution().FindKthLargest(new int[] { 3, 2, 3, 1, 2, 4, 5, 5, 6 }, 4));
14+
}
15+
}
16+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace LeetCodeNet.G0201_0300.S0221_maximal_square {
2+
3+
using Xunit;
4+
5+
public class SolutionTest {
6+
[Fact]
7+
public void MaximalSquare() {
8+
char[][] input = {
9+
new[] {'1', '0', '1', '0', '0'},
10+
new[] {'1', '0', '1', '1', '1'},
11+
new[] {'1', '1', '1', '1', '1'},
12+
new[] {'1', '0', '0', '1', '0'}
13+
};
14+
Assert.Equal(4, new Solution().MaximalSquare(input));
15+
}
16+
17+
[Fact]
18+
public void MaximalSquare2() {
19+
char[][] input = { new[] {'0', '1'}, new[] {'1', '0'} };
20+
Assert.Equal(1, new Solution().MaximalSquare(input));
21+
}
22+
23+
[Fact]
24+
public void MaximalSquare3() {
25+
char[][] input = { new[] {'0'} };
26+
Assert.Equal(0, new Solution().MaximalSquare(input));
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)