fix: 修复C#代码高亮问题

This commit is contained in:
eeee0717
2024-01-04 11:12:29 +08:00
parent b05f66d853
commit 709b5babf0
40 changed files with 50 additions and 50 deletions

View File

@ -618,7 +618,7 @@ char * longestPalindrome(char * s){
### C# ### C#
動態規則: 動態規則:
```c# ```csharp
public class Solution { public class Solution {
public string LongestPalindrome(string s) { public string LongestPalindrome(string s) {
@ -648,7 +648,7 @@ public class Solution {
``` ```
雙指針: 雙指針:
```C# ```csharp
public class Solution { public class Solution {
int maxlenth = 0; int maxlenth = 0;
int left = 0; int left = 0;

View File

@ -733,7 +733,7 @@ def backtracking(result, letter_map, digits, path, index)
end end
``` ```
### C# ### C#
```C# ```csharp
public class Solution public class Solution
{ {
public IList<string> res = new List<string>(); public IList<string> res = new List<string>();

View File

@ -462,7 +462,7 @@ impl Solution {
``` ```
### C# ### C#
```C# ```csharp
// 虚拟头结点 // 虚拟头结点
public ListNode SwapPairs(ListNode head) public ListNode SwapPairs(ListNode head)
{ {

View File

@ -1359,7 +1359,7 @@ impl Solution {
``` ```
>前缀表统一不减一 >前缀表统一不减一
```C# ```csharp
public int StrStr(string haystack, string needle) public int StrStr(string haystack, string needle)
{ {
if (string.IsNullOrEmpty(needle)) if (string.IsNullOrEmpty(needle))

View File

@ -331,7 +331,7 @@ class Solution {
### C# ### C#
```c# ```csharp
public int[] SearchRange(int[] nums, int target) { public int[] SearchRange(int[] nums, int target) {
var leftBorder = GetLeftBorder(nums, target); var leftBorder = GetLeftBorder(nums, target);

View File

@ -537,7 +537,7 @@ object Solution {
### c# ### c#
```c# ```csharp
public class Solution public class Solution
{ {
public int UniquePaths(int m, int n) public int UniquePaths(int m, int n)

View File

@ -470,7 +470,7 @@ object Solution {
### C# ### C#
```c# ```csharp
public class Solution { public class Solution {
public int ClimbStairs(int n) { public int ClimbStairs(int n) {
if(n<=2) return n; if(n<=2) return n;

View File

@ -793,7 +793,7 @@ end
``` ```
### C# ### C#
```C# ```csharp
// 暴力 // 暴力
public class Solution public class Solution
{ {

View File

@ -641,7 +641,7 @@ object Solution {
} }
``` ```
### C# ### C#
```c# ```csharp
public class Solution public class Solution
{ {
public IList<IList<int>> res = new List<IList<int>>(); public IList<IList<int>> res = new List<IList<int>>();

View File

@ -792,7 +792,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public long val = Int64.MinValue; public long val = Int64.MinValue;
public bool IsValidBST(TreeNode root) public bool IsValidBST(TreeNode root)

View File

@ -898,7 +898,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public bool IsSymmetric(TreeNode root) public bool IsSymmetric(TreeNode root)
{ {

View File

@ -463,7 +463,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public IList<IList<int>> LevelOrder(TreeNode root) public IList<IList<int>> LevelOrder(TreeNode root)
{ {
var res = new List<IList<int>>(); var res = new List<IList<int>>();
@ -825,7 +825,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public IList<IList<int>> LevelOrderBottom(TreeNode root) public IList<IList<int>> LevelOrderBottom(TreeNode root)
{ {
var res = new List<IList<int>>(); var res = new List<IList<int>>();

View File

@ -1033,7 +1033,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归法 // 递归法
public int MaxDepth(TreeNode root) { public int MaxDepth(TreeNode root) {
if(root == null) return 0; if(root == null) return 0;
@ -1044,7 +1044,7 @@ public int MaxDepth(TreeNode root) {
return 1 + Math.Max(leftDepth, rightDepth); return 1 + Math.Max(leftDepth, rightDepth);
} }
``` ```
```C# ```csharp
// 前序遍历 // 前序遍历
int result = 0; int result = 0;
public int MaxDepth(TreeNode root) public int MaxDepth(TreeNode root)
@ -1065,7 +1065,7 @@ public void GetDepth(TreeNode root, int depth)
return; return;
} }
``` ```
```C# ```csharp
// 迭代法 // 迭代法
public int MaxDepth(TreeNode root) public int MaxDepth(TreeNode root)
{ {

View File

@ -1229,7 +1229,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public TreeNode BuildTree(int[] inorder, int[] postorder) public TreeNode BuildTree(int[] inorder, int[] postorder)
{ {
if (inorder.Length == 0 || postorder.Length == null) return null; if (inorder.Length == 0 || postorder.Length == null) return null;

View File

@ -909,7 +909,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public bool IsBalanced(TreeNode root) public bool IsBalanced(TreeNode root)
{ {
return GetHeight(root) == -1 ? false : true; return GetHeight(root) == -1 ? false : true;

View File

@ -709,7 +709,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public int MinDepth(TreeNode root) public int MinDepth(TreeNode root)
{ {
@ -725,7 +725,7 @@ public int MinDepth(TreeNode root)
return res; return res;
} }
``` ```
```C# ```csharp
// 迭代 // 迭代
public int MinDepth(TreeNode root) public int MinDepth(TreeNode root)
{ {

View File

@ -1513,7 +1513,7 @@ impl Solution {
``` ```
### C# ### C#
```C# ```csharp
// 0112.路径总和 // 0112.路径总和
// 递归 // 递归
public bool HasPathSum(TreeNode root, int targetSum) public bool HasPathSum(TreeNode root, int targetSum)

View File

@ -973,7 +973,7 @@ char * reverseWords(char * s){
``` ```
### C# ### C#
```C# LINQ高级方法 ```csharp LINQ高级方法
public string ReverseWords(string s) { public string ReverseWords(string s) {
return string.Join(' ', s.Trim().Split(' ',StringSplitOptions.RemoveEmptyEntries).Reverse()); return string.Join(' ', s.Trim().Split(' ',StringSplitOptions.RemoveEmptyEntries).Reverse());
} }

View File

@ -868,7 +868,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public int CountNodes(TreeNode root) public int CountNodes(TreeNode root)
{ {

View File

@ -514,7 +514,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public TreeNode LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) public TreeNode LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q)
{ {

View File

@ -432,7 +432,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public TreeNode LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) public TreeNode LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q)
{ {
if (root == null || root == p || root == q) return root; if (root == null || root == p || root == q) return root;

View File

@ -901,7 +901,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public IList<string> BinaryTreePaths(TreeNode root) public IList<string> BinaryTreePaths(TreeNode root)
{ {
List<int> path = new(); List<int> path = new();

View File

@ -652,7 +652,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public int SumOfLeftLeaves(TreeNode root) public int SumOfLeftLeaves(TreeNode root)
{ {

View File

@ -772,7 +772,7 @@ impl Solution {
### C# ### C#
> 递归法: > 递归法:
```C# ```csharp
public TreeNode DeleteNode(TreeNode root, int key) { public TreeNode DeleteNode(TreeNode root, int key) {
// 第一种情况:没找到删除的节点,遍历到空节点直接返回了 // 第一种情况:没找到删除的节点,遍历到空节点直接返回了
if (root == null) return null; if (root == null) return null;

View File

@ -682,7 +682,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 前缀表不减一 // 前缀表不减一
public bool RepeatedSubstringPattern(string s) public bool RepeatedSubstringPattern(string s)
{ {

View File

@ -1010,7 +1010,7 @@ pub fn find_mode(root: Option<Rc<RefCell<TreeNode>>>) -> Vec<i32> {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public class Solution public class Solution
{ {

View File

@ -439,7 +439,7 @@ object Solution {
动态规划: 动态规划:
```c# ```csharp
public class Solution public class Solution
{ {
public int Fib(int n) public int Fib(int n)
@ -459,7 +459,7 @@ public class Solution
递归: 递归:
```c# ```csharp
public class Solution public class Solution
{ {
public int Fib(int n) public int Fib(int n)

View File

@ -685,7 +685,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
//递归 //递归
int maxDepth = -1; int maxDepth = -1;
int res = 0; int res = 0;

View File

@ -648,7 +648,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public class Solution public class Solution
{ {

View File

@ -530,7 +530,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public class Solution public class Solution
{ {

View File

@ -789,7 +789,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public TreeNode MergeTrees(TreeNode root1, TreeNode root2) public TreeNode MergeTrees(TreeNode root1, TreeNode root2)
{ {
if (root1 == null) return root2; if (root1 == null) return root2;

View File

@ -583,7 +583,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public TreeNode ConstructMaximumBinaryTree(int[] nums) public TreeNode ConstructMaximumBinaryTree(int[] nums)
{ {
if (nums.Length == 0) return null; if (nums.Length == 0) return null;

View File

@ -568,7 +568,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public TreeNode TrimBST(TreeNode root, int low, int high) public TreeNode TrimBST(TreeNode root, int low, int high)
{ {

View File

@ -465,7 +465,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 递归 // 递归
public TreeNode SearchBST(TreeNode root, int val) public TreeNode SearchBST(TreeNode root, int val)
{ {

View File

@ -1486,7 +1486,7 @@ impl MyLinkedList {
``` ```
### C# ### C#
```C# ```csharp
class ListNode class ListNode
{ {
public int val; public int val;

View File

@ -500,7 +500,7 @@ object Solution {
### C# ### C#
```c# ```csharp
public class Solution public class Solution
{ {
public int MinCostClimbingStairs(int[] cost) public int MinCostClimbingStairs(int[] cost)

View File

@ -742,7 +742,7 @@ impl Solution{
} }
``` ```
### C# ### C#
```C# ```csharp
// 前序遍历 // 前序遍历
public IList<int> PreorderTraversal(TreeNode root) public IList<int> PreorderTraversal(TreeNode root)
{ {
@ -772,7 +772,7 @@ public IList<int> PreorderTraversal(TreeNode root)
return res; return res;
} }
``` ```
```C# ```csharp
// 中序遍历 // 中序遍历
public IList<int> InorderTraversal(TreeNode root) public IList<int> InorderTraversal(TreeNode root)
{ {
@ -803,7 +803,7 @@ public IList<int> InorderTraversal(TreeNode root)
} }
``` ```
```C# ```csharp
// 后序遍历 // 后序遍历
public IList<int> PostorderTraversal(TreeNode root) public IList<int> PostorderTraversal(TreeNode root)
{ {

View File

@ -696,7 +696,7 @@ impl Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
// 前序遍历 // 前序遍历
public IList<int> PreorderTraversal(TreeNode root) public IList<int> PreorderTraversal(TreeNode root)
{ {

View File

@ -566,7 +566,7 @@ impl Solution {
``` ```
### C# ### C#
```C# ```csharp
// 前序遍历 // 前序遍历
public IList<int> PreorderTraversal(TreeNode root) public IList<int> PreorderTraversal(TreeNode root)
{ {
@ -584,7 +584,7 @@ public void Traversal(TreeNode cur, IList<int> res)
Traversal(cur.right, res); Traversal(cur.right, res);
} }
``` ```
```C# ```csharp
// 中序遍历 // 中序遍历
public IList<int> InorderTraversal(TreeNode root) public IList<int> InorderTraversal(TreeNode root)
{ {
@ -601,7 +601,7 @@ public void Traversal(TreeNode cur, IList<int> res)
Traversal(cur.right, res); Traversal(cur.right, res);
} }
``` ```
```C# ```csharp
// 后序遍历 // 后序遍历
public IList<int> PostorderTraversal(TreeNode root) public IList<int> PostorderTraversal(TreeNode root)
{ {

View File

@ -503,7 +503,7 @@ object Solution {
} }
``` ```
### C# ### C#
```C# ```csharp
public ListNode GetIntersectionNode(ListNode headA, ListNode headB) public ListNode GetIntersectionNode(ListNode headA, ListNode headB)
{ {
if (headA == null || headB == null) return null; if (headA == null || headB == null) return null;