diff --git a/20. Valid Parentheses/20. Valid Parentheses.csproj b/20. Valid Parentheses/20. Valid Parentheses.csproj
new file mode 100644
index 0000000..f750141
--- /dev/null
+++ b/20. Valid Parentheses/20. Valid Parentheses.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _20._Valid_Parentheses
+ enable
+ enable
+
+
+
diff --git a/20. Valid Parentheses/Program.cs b/20. Valid Parentheses/Program.cs
new file mode 100644
index 0000000..37ff616
--- /dev/null
+++ b/20. Valid Parentheses/Program.cs
@@ -0,0 +1,9 @@
+namespace _20._Valid_Parentheses;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ Console.WriteLine(new Solution().IsValid("([)]"));
+ }
+}
diff --git a/20. Valid Parentheses/Solution.cs b/20. Valid Parentheses/Solution.cs
new file mode 100644
index 0000000..53a1b21
--- /dev/null
+++ b/20. Valid Parentheses/Solution.cs
@@ -0,0 +1,68 @@
+using System.Text;
+
+namespace _20._Valid_Parentheses;
+
+public class Solution
+{
+ public bool IsValid(string s)
+ {
+ StringBuilder sb = new StringBuilder(s);
+ if (sb.Length == 0)
+ return true;
+ if (sb.Length % 2 == 1)
+ return false;
+ while(sb.Length > 0)
+ {
+ char ch = sb[0];
+ if ("({[".Contains(ch) == false)
+ return false;
+ char need = ch switch
+ {
+ '(' => ')',
+ '{' => '}',
+ '[' => ']',
+ _ => '\0'
+ };
+ int count1 = 0;// ()
+ int count2 = 0;// {}
+ int count3 = 0;// []
+ bool succes = false;
+ for(int i = 1; i < sb.Length; i++)
+ {
+ char c = sb[i];
+ if (count1 == 0 && count2 == 0 && count3 == 0 && c == need)
+ {
+ sb.Remove(i, 1).Remove(0, 1);
+ succes = true;
+ break;
+ }
+ switch (c)
+ {
+ case '(':
+ count1++;
+ break;
+ case ')':
+ count1--;
+ break;
+
+ case '{':
+ count2++;
+ break;
+ case '}':
+ count2--;
+ break;
+
+ case '[':
+ count3++;
+ break;
+ case ']':
+ count3--;
+ break;
+ }
+ }
+ if(succes == false)
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/200. Number of Islands/200. Number of Islands.csproj b/200. Number of Islands/200. Number of Islands.csproj
new file mode 100644
index 0000000..fbd67fd
--- /dev/null
+++ b/200. Number of Islands/200. Number of Islands.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _200._Number_of_Islands
+ enable
+ enable
+
+
+
diff --git a/200. Number of Islands/Program.cs b/200. Number of Islands/Program.cs
new file mode 100644
index 0000000..729bf7b
--- /dev/null
+++ b/200. Number of Islands/Program.cs
@@ -0,0 +1,9 @@
+namespace _200._Number_of_Islands;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Hello, World!");
+ }
+}
diff --git a/200. Number of Islands/Solution.cs b/200. Number of Islands/Solution.cs
new file mode 100644
index 0000000..96ec932
--- /dev/null
+++ b/200. Number of Islands/Solution.cs
@@ -0,0 +1,42 @@
+using System.ComponentModel;
+
+namespace _200._Number_of_Islands;
+
+public class Solution
+{
+ public int NumIslands(char[][] grid)
+ {
+ int[][] was = new int[grid.Length][];
+ for (int i = 0; i < grid.Length; i++)
+ was[i] = new int[grid[i].Length];
+
+ int curId = 0;
+ for (int y = 0; y < grid.Length; y++)
+ {
+ for (int x = 0; x < grid[y].Length; x++)
+ {
+ if (was[y][x] == 0 && grid[y][x] == '1')
+ curId++;
+ else
+ continue;
+
+ Recursion(grid, was, y, x, curId);
+ }
+ }
+ return curId;
+ }
+
+ private void Recursion(char[][] grid, int[][] was, int y, int x, int id)
+ {
+ if (was[y][x]!=0 || grid[y][x] != '1')
+ return;
+ was[y][x] = id;
+ for (int i = 1; i < 8; i += 2)
+ {
+ int nextY = i / 3 + y - 1;
+ int nextX = i % 3 + x - 1;
+ if (nextY >= 0 && nextY < was.Length && nextX >= 0 && nextX < was[nextY].Length)
+ Recursion(grid, was, nextY, nextX, id);
+ }
+ }
+}
diff --git a/232. Implement Queue using Stacks/232. Implement Queue using Stacks.csproj b/232. Implement Queue using Stacks/232. Implement Queue using Stacks.csproj
new file mode 100644
index 0000000..6b05a14
--- /dev/null
+++ b/232. Implement Queue using Stacks/232. Implement Queue using Stacks.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _232._Implement_Queue_using_Stacks
+ enable
+ enable
+
+
+
diff --git a/232. Implement Queue using Stacks/MyQueue.cs b/232. Implement Queue using Stacks/MyQueue.cs
new file mode 100644
index 0000000..f8f5e8d
--- /dev/null
+++ b/232. Implement Queue using Stacks/MyQueue.cs
@@ -0,0 +1,35 @@
+namespace _232._Implement_Queue_using_Stacks;
+
+public class MyQueue
+{
+ private Stack _sInput = new Stack();
+ private Stack _sOutput = new Stack();
+
+ public void Push(int x)
+ {
+ while(_sOutput.TryPop(out int res))
+ _sInput.Push(res);
+ _sInput.Push(x);
+ }
+
+ public int Pop()
+ {
+ while(_sInput.TryPop(out int res))
+ _sOutput.Push(res);
+ return _sOutput.Pop();
+ }
+
+ public int Peek()
+ {
+ while (_sInput.TryPop(out int res))
+ _sOutput.Push(res);
+ return _sOutput.Peek();
+ }
+
+ public bool Empty()
+ {
+ while (_sInput.TryPop(out int res))
+ _sOutput.Push(res);
+ return _sOutput.Count == 0;
+ }
+}
diff --git a/232. Implement Queue using Stacks/Program.cs b/232. Implement Queue using Stacks/Program.cs
new file mode 100644
index 0000000..538f626
--- /dev/null
+++ b/232. Implement Queue using Stacks/Program.cs
@@ -0,0 +1,9 @@
+namespace _232._Implement_Queue_using_Stacks;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Hello, World!");
+ }
+}
diff --git a/235. Lowest Common Ancestor of a Binary Search Tree/235. Lowest Common Ancestor of a Binary Search Tree.csproj b/235. Lowest Common Ancestor of a Binary Search Tree/235. Lowest Common Ancestor of a Binary Search Tree.csproj
new file mode 100644
index 0000000..2a8d3ca
--- /dev/null
+++ b/235. Lowest Common Ancestor of a Binary Search Tree/235. Lowest Common Ancestor of a Binary Search Tree.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _235._Lowest_Common_Ancestor_of_a_Binary_Search_Tree
+ enable
+ enable
+
+
+
diff --git a/235. Lowest Common Ancestor of a Binary Search Tree/Program.cs b/235. Lowest Common Ancestor of a Binary Search Tree/Program.cs
new file mode 100644
index 0000000..459ae49
--- /dev/null
+++ b/235. Lowest Common Ancestor of a Binary Search Tree/Program.cs
@@ -0,0 +1,12 @@
+namespace _235._Lowest_Common_Ancestor_of_a_Binary_Search_Tree;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ TreeNode root = new TreeNode(6);
+ root.left = new TreeNode(2) { left = new TreeNode(0), right = new TreeNode(4) { left = new TreeNode(3), right = new TreeNode(5) } };
+ root.right = new TreeNode(8) { left = new TreeNode(7), right = new TreeNode(9) };
+ Console.WriteLine(new Solution().LowestCommonAncestor(root, new TreeNode(3), new TreeNode(5)).val);
+ }
+}
diff --git a/235. Lowest Common Ancestor of a Binary Search Tree/Solution.cs b/235. Lowest Common Ancestor of a Binary Search Tree/Solution.cs
new file mode 100644
index 0000000..4cbd6e0
--- /dev/null
+++ b/235. Lowest Common Ancestor of a Binary Search Tree/Solution.cs
@@ -0,0 +1,21 @@
+namespace _235._Lowest_Common_Ancestor_of_a_Binary_Search_Tree;
+
+public class Solution
+{
+ public TreeNode? LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q)
+ {
+ int min = Math.Min(p.val, q.val);
+ int max = Math.Max(p.val, q.val);
+ while(true)
+ {
+ if (root == null)
+ return null;
+ else if (min <= root.val && max>=root.val)
+ return root;
+ else if (root.val >= p.val)
+ root = root.left!;
+ else
+ root = root.right!;
+ }
+ }
+}
\ No newline at end of file
diff --git a/235. Lowest Common Ancestor of a Binary Search Tree/TreeNode.cs b/235. Lowest Common Ancestor of a Binary Search Tree/TreeNode.cs
new file mode 100644
index 0000000..e732324
--- /dev/null
+++ b/235. Lowest Common Ancestor of a Binary Search Tree/TreeNode.cs
@@ -0,0 +1,9 @@
+namespace _235._Lowest_Common_Ancestor_of_a_Binary_Search_Tree;
+
+//Definition for a binary tree node.
+public class TreeNode {
+ public int val;
+ public TreeNode? left;
+ public TreeNode? right;
+ public TreeNode(int x) { val = x; }
+}
diff --git a/3. Longest Substring Without Repeating Characters/3. Longest Substring Without Repeating Characters.csproj b/3. Longest Substring Without Repeating Characters/3. Longest Substring Without Repeating Characters.csproj
new file mode 100644
index 0000000..7a6f338
--- /dev/null
+++ b/3. Longest Substring Without Repeating Characters/3. Longest Substring Without Repeating Characters.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _3._Longest_Substring_Without_Repeating_Characters
+ enable
+ enable
+
+
+
diff --git a/3. Longest Substring Without Repeating Characters/Program.cs b/3. Longest Substring Without Repeating Characters/Program.cs
new file mode 100644
index 0000000..d5f49bd
--- /dev/null
+++ b/3. Longest Substring Without Repeating Characters/Program.cs
@@ -0,0 +1,9 @@
+namespace _3._Longest_Substring_Without_Repeating_Characters;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ Console.WriteLine(new Solution().LengthOfLongestSubstring("dvdf"));
+ }
+}
diff --git a/3. Longest Substring Without Repeating Characters/Solution.cs b/3. Longest Substring Without Repeating Characters/Solution.cs
new file mode 100644
index 0000000..ae9111e
--- /dev/null
+++ b/3. Longest Substring Without Repeating Characters/Solution.cs
@@ -0,0 +1,24 @@
+namespace _3._Longest_Substring_Without_Repeating_Characters;
+
+public class Solution
+{
+ public int LengthOfLongestSubstring(string s)
+ {
+ int max = 0;
+ Dictionary dict = new Dictionary();
+ for(int i = 0; i < s.Length; i++)
+ {
+ char c = s[i];
+ if(dict.ContainsKey(c))
+ {
+ max = Math.Max(max, dict.Count);
+ i = dict[c];
+ dict.Clear();
+ }
+ else
+ dict.Add(c, i);
+ }
+ max = Math.Max(max, dict.Count);
+ return max;
+ }
+}
diff --git a/567. Permutation in String/567. Permutation in String.csproj b/567. Permutation in String/567. Permutation in String.csproj
new file mode 100644
index 0000000..3eba631
--- /dev/null
+++ b/567. Permutation in String/567. Permutation in String.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _567._Permutation_in_String
+ enable
+ enable
+
+
+
diff --git a/567. Permutation in String/Program.cs b/567. Permutation in String/Program.cs
new file mode 100644
index 0000000..f0f3231
--- /dev/null
+++ b/567. Permutation in String/Program.cs
@@ -0,0 +1,9 @@
+namespace _567._Permutation_in_String;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ Console.WriteLine(new Solution().CheckInclusion("adc", "dcda"));
+ }
+}
diff --git a/567. Permutation in String/Solution.cs b/567. Permutation in String/Solution.cs
new file mode 100644
index 0000000..1a6e7fd
--- /dev/null
+++ b/567. Permutation in String/Solution.cs
@@ -0,0 +1,39 @@
+namespace _567._Permutation_in_String;
+
+public class Solution
+{
+ public bool CheckInclusion(string s1, string s2)
+ {
+ int[] letters = new int[26];
+ foreach (char c in s1)
+ letters[c-97]++;
+ int[] buff = new int[26];
+ Array.Copy(letters, buff, letters.Length);
+ for (int i = 0; i <= s2.Length-s1.Length; i++)
+ {
+ if (letters[s2[i]-97] != 0)
+ {
+ Array.Copy(letters, buff, letters.Length);
+ for(int j = i; j < i + s1.Length; j++)
+ {
+ char ch = s2[j];
+ buff[ch - 97]--;
+ if (buff[ch-97] < 0)
+ break;
+ }
+ bool win = true;
+ for (int bIndex = 0; bIndex < buff.Length; bIndex++)
+ {
+ if (buff[bIndex] != 0)
+ {
+ win = false;
+ break;
+ }
+ }
+ if (win)
+ return true;
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/695. Max Area of Island/695. Max Area of Island.csproj b/695. Max Area of Island/695. Max Area of Island.csproj
new file mode 100644
index 0000000..dfecafb
--- /dev/null
+++ b/695. Max Area of Island/695. Max Area of Island.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _695._Max_Area_of_Island
+ enable
+ enable
+
+
+
diff --git a/695. Max Area of Island/Program.cs b/695. Max Area of Island/Program.cs
new file mode 100644
index 0000000..84ead6d
--- /dev/null
+++ b/695. Max Area of Island/Program.cs
@@ -0,0 +1,10 @@
+namespace _695._Max_Area_of_Island;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ int[][] matrix = {new int[] {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},new int[] {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0},new int[] {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},new int[] {0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0},new int[] {0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0},new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},new int[] {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0},new int[] {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0}};
+ Console.WriteLine(new Solution().MaxAreaOfIsland(matrix));
+ }
+}
diff --git a/695. Max Area of Island/Solution.cs b/695. Max Area of Island/Solution.cs
new file mode 100644
index 0000000..6082dfe
--- /dev/null
+++ b/695. Max Area of Island/Solution.cs
@@ -0,0 +1,41 @@
+namespace _695._Max_Area_of_Island;
+
+public class Solution
+{
+ public int MaxAreaOfIsland(int[][] grid)
+ {
+ bool[][] visited = new bool[grid.Length][];
+ for (int i = 0; i < visited.Length; i++)
+ visited[i] = new bool[grid[i].Length];
+
+ int max = 0;
+ for (int y = 0; y < grid.Length; y++)
+ {
+ for (int x = 0; x < grid[y].Length; x++)
+ {
+ if (grid[y][x] == 0)
+ continue;
+
+ int curCount = 0;
+ Recursion(grid, y, x, ref curCount, visited);
+ max = Math.Max(max, curCount);
+ }
+ }
+ return max;
+ }
+
+ private void Recursion(int[][] grid, int y, int x, ref int count, bool[][] visited)
+ {
+ if (visited[y][x] || grid[y][x] == 0)
+ return;
+ visited[y][x] = true;
+ count++;
+ for (int i = 1; i < 8; i += 2)
+ {
+ int nextY = i / 3 + y - 1;
+ int nextX = i % 3 + x - 1;
+ if (nextY >= 0 && nextY < grid.Length && nextX >= 0 && nextX < grid[nextY].Length)
+ Recursion(grid, nextY, nextX, ref count, visited);
+ }
+ }
+}
diff --git a/733. Flood Fill/733. Flood Fill.csproj b/733. Flood Fill/733. Flood Fill.csproj
new file mode 100644
index 0000000..1dd8237
--- /dev/null
+++ b/733. Flood Fill/733. Flood Fill.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _733._Flood_Fill
+ enable
+ enable
+
+
+
diff --git a/733. Flood Fill/Program.cs b/733. Flood Fill/Program.cs
new file mode 100644
index 0000000..5a3d074
--- /dev/null
+++ b/733. Flood Fill/Program.cs
@@ -0,0 +1,14 @@
+namespace _733._Flood_Fill;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ int[][] matrix = new int[][] { new int[] { 1,1,1 },
+ new int[] { 1,1,0 },
+ new int[] { 1,0,1 } };
+ var res = new Solution().FloodFill(matrix, 1,1, 2);
+ foreach(var row in res)
+ Console.WriteLine(String.Join(" ", row));
+ }
+}
diff --git a/733. Flood Fill/Solution.cs b/733. Flood Fill/Solution.cs
new file mode 100644
index 0000000..4135b33
--- /dev/null
+++ b/733. Flood Fill/Solution.cs
@@ -0,0 +1,32 @@
+namespace _733._Flood_Fill;
+
+public class Solution
+{
+ public int[][] FloodFill(int[][] image, int sr, int sc, int color)
+ {
+ int[][] res = new int[image.Length][];
+ for (int i = 0; i < res.Length; i++)
+ res[i] = image[i].ToArray();
+
+ bool[][] colored = new bool[image.Length][];
+ for (int i = 0; i < colored.Length; i++)
+ colored[i] = new bool[image[i].Length];
+ Recursion(res, sr, sc, res[sr][sc], color, colored);
+ return res;
+ }
+
+ private void Recursion(int[][] image, int y, int x, int sourceColor, int toColor, bool[][] colored)
+ {
+ if (image[y][x] != sourceColor || colored[y][x])
+ return;
+ image[y][x] = toColor;
+ colored[y][x] = true;
+ for (int i = 1; i < 8; i += 2)
+ {
+ int nextY = i / 3 + y - 1;
+ int nextX = i % 3 + x - 1;
+ if (nextY >= 0 && nextY < image.Length && nextX >= 0 && nextX < image[nextY].Length)
+ Recursion(image, nextY, nextX, sourceColor, toColor, colored);
+ }
+ }
+}
diff --git a/83. Remove Duplicates from Sorted List/83. Remove Duplicates from Sorted List.csproj b/83. Remove Duplicates from Sorted List/83. Remove Duplicates from Sorted List.csproj
new file mode 100644
index 0000000..7334fc9
--- /dev/null
+++ b/83. Remove Duplicates from Sorted List/83. Remove Duplicates from Sorted List.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _83._Remove_Duplicates_from_Sorted_List
+ enable
+ enable
+
+
+
diff --git a/83. Remove Duplicates from Sorted List/ListNode.cs b/83. Remove Duplicates from Sorted List/ListNode.cs
new file mode 100644
index 0000000..c8be93f
--- /dev/null
+++ b/83. Remove Duplicates from Sorted List/ListNode.cs
@@ -0,0 +1,37 @@
+namespace _83._Remove_Duplicates_from_Sorted_List;
+
+//Definition for singly-linked list.
+public class ListNode
+{
+ public int val;
+ public ListNode? next;
+ public ListNode(int val = 0, ListNode? next = null)
+ {
+ this.val = val;
+ this.next = next;
+ }
+
+ public static ListNode Create(int[] nums)
+ {
+ ListNode l = new ListNode(nums[0]);
+ ListNode cur = l;
+ for (int i = 1; i < nums.Length; i++)
+ {
+ cur.next = new ListNode(nums[i]);
+ cur = cur.next;
+ }
+ return l;
+ }
+
+ public override string ToString()
+ {
+ List list = new List();
+ ListNode? cur = this;
+ while (cur != null)
+ {
+ list.Add(cur.val);
+ cur = cur.next;
+ }
+ return String.Join(" ", list);
+ }
+}
diff --git a/83. Remove Duplicates from Sorted List/Program.cs b/83. Remove Duplicates from Sorted List/Program.cs
new file mode 100644
index 0000000..c1975c8
--- /dev/null
+++ b/83. Remove Duplicates from Sorted List/Program.cs
@@ -0,0 +1,17 @@
+namespace _83._Remove_Duplicates_from_Sorted_List;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ ListNode l1 = new ListNode(1);
+ ListNode l2 = new ListNode(1);
+ ListNode l3 = new ListNode(4);
+ ListNode l4 = new ListNode(4);
+
+ l1.next = l2;
+ l2.next = l3;
+ l3.next = l4;
+ Console.WriteLine(new Solution().DeleteDuplicates(null));
+ }
+}
diff --git a/83. Remove Duplicates from Sorted List/Solution.cs b/83. Remove Duplicates from Sorted List/Solution.cs
new file mode 100644
index 0000000..45c7e7a
--- /dev/null
+++ b/83. Remove Duplicates from Sorted List/Solution.cs
@@ -0,0 +1,26 @@
+namespace _83._Remove_Duplicates_from_Sorted_List;
+
+public class Solution
+{
+ public ListNode? DeleteDuplicates(ListNode? head)
+ {
+ ListNode? first = null;
+ ListNode? current = null;
+ while (head != null)
+ {
+ if (first == null)
+ first = current = head;
+ if (head.val == current!.val)
+ {
+ head = head.next;
+ continue;
+ }
+ current!.next = head;
+ current = current.next;
+ head = head.next;
+ }
+ if(current != null)
+ current.next = null;
+ return first;
+ }
+}
\ No newline at end of file
diff --git a/98. Validate Binary Search Tree/98. Validate Binary Search Tree.csproj b/98. Validate Binary Search Tree/98. Validate Binary Search Tree.csproj
new file mode 100644
index 0000000..72ef4cf
--- /dev/null
+++ b/98. Validate Binary Search Tree/98. Validate Binary Search Tree.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Exe
+ net6.0
+ _98._Validate_Binary_Search_Tree
+ enable
+ enable
+
+
+
diff --git a/98. Validate Binary Search Tree/Program.cs b/98. Validate Binary Search Tree/Program.cs
new file mode 100644
index 0000000..04c81ec
--- /dev/null
+++ b/98. Validate Binary Search Tree/Program.cs
@@ -0,0 +1,9 @@
+namespace _98._Validate_Binary_Search_Tree;
+
+internal class Program
+{
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Hello, World!");
+ }
+}
diff --git a/98. Validate Binary Search Tree/Solution.cs b/98. Validate Binary Search Tree/Solution.cs
new file mode 100644
index 0000000..0737c85
--- /dev/null
+++ b/98. Validate Binary Search Tree/Solution.cs
@@ -0,0 +1,21 @@
+namespace _98._Validate_Binary_Search_Tree;
+
+public class Solution
+{
+ public bool IsValidBST(TreeNode root)
+ {
+ return Rec(root, null, null);
+ }
+
+ private bool Rec(TreeNode node, int? lessThan, int? moreThan)
+ {
+ if((lessThan != null && node.val >= lessThan) || (moreThan != null && node.val <= moreThan))
+ return false;
+ bool res = true;
+ if(node.left != null)
+ res&=Rec(node.left, node.val, moreThan);
+ if(node.right != null)
+ res &=Rec(node.right, lessThan, node.val);
+ return res;
+ }
+}
diff --git a/98. Validate Binary Search Tree/TreeNode.cs b/98. Validate Binary Search Tree/TreeNode.cs
new file mode 100644
index 0000000..d52b292
--- /dev/null
+++ b/98. Validate Binary Search Tree/TreeNode.cs
@@ -0,0 +1,16 @@
+namespace _98._Validate_Binary_Search_Tree;
+
+
+//Definition for a binary tree node.
+public class TreeNode
+{
+ public int val;
+ public TreeNode? left;
+ public TreeNode? right;
+ public TreeNode(int val = 0, TreeNode? left = null, TreeNode? right = null)
+ {
+ this.val = val;
+ this.left = left;
+ this.right = right;
+ }
+}
diff --git a/Leetcode.sln b/Leetcode.sln
index 8376216..809017f 100644
--- a/Leetcode.sln
+++ b/Leetcode.sln
@@ -71,11 +71,31 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "589. N-ary Tree Preorder Tr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "102. Binary Tree Level Order Traversal", "102. Binary Tree Level Order Traversal\102. Binary Tree Level Order Traversal.csproj", "{557D8195-C886-4B52-BBC4-285A1C1057FF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "141. Linked List Cycle", "141. Linked List Cycle\141. Linked List Cycle.csproj", "{EC089303-B1E1-482F-BAED-530DAB4C1346}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "141. Linked List Cycle", "141. Linked List Cycle\141. Linked List Cycle.csproj", "{EC089303-B1E1-482F-BAED-530DAB4C1346}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "203. Remove Linked List Elements", "203. Remove Linked List Elements\203. Remove Linked List Elements.csproj", "{F2C5A71D-91C7-4270-8150-8D96DA73538C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "203. Remove Linked List Elements", "203. Remove Linked List Elements\203. Remove Linked List Elements.csproj", "{F2C5A71D-91C7-4270-8150-8D96DA73538C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "19. Remove Nth Node From End of List", "19. Remove Nth Node From End of List\19. Remove Nth Node From End of List.csproj", "{88473211-C7AD-4F83-92C2-D4E6B9BB9D8A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "19. Remove Nth Node From End of List", "19. Remove Nth Node From End of List\19. Remove Nth Node From End of List.csproj", "{88473211-C7AD-4F83-92C2-D4E6B9BB9D8A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "3. Longest Substring Without Repeating Characters", "3. Longest Substring Without Repeating Characters\3. Longest Substring Without Repeating Characters.csproj", "{B63CF842-6B6E-48BA-B9E5-CCCBC0AE34EC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "567. Permutation in String", "567. Permutation in String\567. Permutation in String.csproj", "{AC0417D5-D2AE-4E55-92F1-384A03990678}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "733. Flood Fill", "733. Flood Fill\733. Flood Fill.csproj", "{6574DD3F-F45E-4AD2-9107-83A2829EF4A0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "695. Max Area of Island", "695. Max Area of Island\695. Max Area of Island.csproj", "{7D77DF91-D338-401D-9553-DBD588C25EA4}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "83. Remove Duplicates from Sorted List", "83. Remove Duplicates from Sorted List\83. Remove Duplicates from Sorted List.csproj", "{7468301A-2AE8-415B-9680-D858B936ED47}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "20. Valid Parentheses", "20. Valid Parentheses\20. Valid Parentheses.csproj", "{B9251922-A37F-4897-9BF6-A68BB30D60CD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "232. Implement Queue using Stacks", "232. Implement Queue using Stacks\232. Implement Queue using Stacks.csproj", "{A068ABAC-F412-4017-BD8B-E245FF289713}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "98. Validate Binary Search Tree", "98. Validate Binary Search Tree\98. Validate Binary Search Tree.csproj", "{DB61AA75-8C2C-4E16-8A8E-781B831BE81A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "235. Lowest Common Ancestor of a Binary Search Tree", "235. Lowest Common Ancestor of a Binary Search Tree\235. Lowest Common Ancestor of a Binary Search Tree.csproj", "{B4466695-F56D-40E6-8D9C-D5955ACE8B4E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "200. Number of Islands", "200. Number of Islands\200. Number of Islands.csproj", "{02FDE4A9-07D5-46B6-95AB-B61E1F3BA97B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -231,6 +251,46 @@ Global
{88473211-C7AD-4F83-92C2-D4E6B9BB9D8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88473211-C7AD-4F83-92C2-D4E6B9BB9D8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88473211-C7AD-4F83-92C2-D4E6B9BB9D8A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B63CF842-6B6E-48BA-B9E5-CCCBC0AE34EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B63CF842-6B6E-48BA-B9E5-CCCBC0AE34EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B63CF842-6B6E-48BA-B9E5-CCCBC0AE34EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B63CF842-6B6E-48BA-B9E5-CCCBC0AE34EC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AC0417D5-D2AE-4E55-92F1-384A03990678}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AC0417D5-D2AE-4E55-92F1-384A03990678}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AC0417D5-D2AE-4E55-92F1-384A03990678}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AC0417D5-D2AE-4E55-92F1-384A03990678}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6574DD3F-F45E-4AD2-9107-83A2829EF4A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6574DD3F-F45E-4AD2-9107-83A2829EF4A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6574DD3F-F45E-4AD2-9107-83A2829EF4A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6574DD3F-F45E-4AD2-9107-83A2829EF4A0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D77DF91-D338-401D-9553-DBD588C25EA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D77DF91-D338-401D-9553-DBD588C25EA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D77DF91-D338-401D-9553-DBD588C25EA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D77DF91-D338-401D-9553-DBD588C25EA4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7468301A-2AE8-415B-9680-D858B936ED47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7468301A-2AE8-415B-9680-D858B936ED47}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7468301A-2AE8-415B-9680-D858B936ED47}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7468301A-2AE8-415B-9680-D858B936ED47}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B9251922-A37F-4897-9BF6-A68BB30D60CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B9251922-A37F-4897-9BF6-A68BB30D60CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B9251922-A37F-4897-9BF6-A68BB30D60CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B9251922-A37F-4897-9BF6-A68BB30D60CD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A068ABAC-F412-4017-BD8B-E245FF289713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A068ABAC-F412-4017-BD8B-E245FF289713}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A068ABAC-F412-4017-BD8B-E245FF289713}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A068ABAC-F412-4017-BD8B-E245FF289713}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DB61AA75-8C2C-4E16-8A8E-781B831BE81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DB61AA75-8C2C-4E16-8A8E-781B831BE81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DB61AA75-8C2C-4E16-8A8E-781B831BE81A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DB61AA75-8C2C-4E16-8A8E-781B831BE81A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B4466695-F56D-40E6-8D9C-D5955ACE8B4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B4466695-F56D-40E6-8D9C-D5955ACE8B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B4466695-F56D-40E6-8D9C-D5955ACE8B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B4466695-F56D-40E6-8D9C-D5955ACE8B4E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {02FDE4A9-07D5-46B6-95AB-B61E1F3BA97B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {02FDE4A9-07D5-46B6-95AB-B61E1F3BA97B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {02FDE4A9-07D5-46B6-95AB-B61E1F3BA97B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {02FDE4A9-07D5-46B6-95AB-B61E1F3BA97B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE