-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aef5d1c
commit 4b0c1ae
Showing
188 changed files
with
852 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
|
||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeetCode.Tests", "tests\LeetCode.Tests\LeetCode.Tests.csproj", "{CAA5DCE2-1A75-45A5-A7D9-521ADE361A48}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CAFF904D-2B73-475E-A8BE-EFF7084DF271}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NeetCode.Tests", "tests\NeetCode.Tests\NeetCode.Tests.csproj", "{36E805B7-9CB6-4FF1-B582-E22482D2F788}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{840433FA-1042-44BF-9627-5DAF7B8132D4}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeetCode.Solutions", "src\LeetCode.Solutions\LeetCode.Solutions.csproj", "{9C96DEB1-9DE2-45B0-88E1-E1EAEE05E8E3}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NeetCode.Solutions", "src\NeetCode.Solutions\NeetCode.Solutions.csproj", "{54A495C1-39F6-4470-807B-743A9BA98572}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "src\Core\Core.csproj", "{5A0AC37B-F586-4EB4-90AE-14AA587F678B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CAA5DCE2-1A75-45A5-A7D9-521ADE361A48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CAA5DCE2-1A75-45A5-A7D9-521ADE361A48}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CAA5DCE2-1A75-45A5-A7D9-521ADE361A48}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CAA5DCE2-1A75-45A5-A7D9-521ADE361A48}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{36E805B7-9CB6-4FF1-B582-E22482D2F788}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{36E805B7-9CB6-4FF1-B582-E22482D2F788}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{36E805B7-9CB6-4FF1-B582-E22482D2F788}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{36E805B7-9CB6-4FF1-B582-E22482D2F788}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{9C96DEB1-9DE2-45B0-88E1-E1EAEE05E8E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9C96DEB1-9DE2-45B0-88E1-E1EAEE05E8E3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9C96DEB1-9DE2-45B0-88E1-E1EAEE05E8E3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9C96DEB1-9DE2-45B0-88E1-E1EAEE05E8E3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{54A495C1-39F6-4470-807B-743A9BA98572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{54A495C1-39F6-4470-807B-743A9BA98572}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{54A495C1-39F6-4470-807B-743A9BA98572}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{54A495C1-39F6-4470-807B-743A9BA98572}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5A0AC37B-F586-4EB4-90AE-14AA587F678B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5A0AC37B-F586-4EB4-90AE-14AA587F678B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5A0AC37B-F586-4EB4-90AE-14AA587F678B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5A0AC37B-F586-4EB4-90AE-14AA587F678B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{CAA5DCE2-1A75-45A5-A7D9-521ADE361A48} = {CAFF904D-2B73-475E-A8BE-EFF7084DF271} | ||
{36E805B7-9CB6-4FF1-B582-E22482D2F788} = {CAFF904D-2B73-475E-A8BE-EFF7084DF271} | ||
{9C96DEB1-9DE2-45B0-88E1-E1EAEE05E8E3} = {840433FA-1042-44BF-9627-5DAF7B8132D4} | ||
{54A495C1-39F6-4470-807B-743A9BA98572} = {840433FA-1042-44BF-9627-5DAF7B8132D4} | ||
{5A0AC37B-F586-4EB4-90AE-14AA587F678B} = {840433FA-1042-44BF-9627-5DAF7B8132D4} | ||
EndGlobalSection | ||
EndGlobal |
3 changes: 2 additions & 1 deletion
3
...Solutions/Attributes/ApproachAttribute.cs → src/Core/Attributes/ApproachAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...lutions/Attributes/CompaniesAttributes.cs → src/Core/Attributes/CompaniesAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...de.Solutions/Attributes/LevelAttribute.cs → src/Core/Attributes/LevelAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ns/Attributes/SpaceComplexityAttribute.cs → ...re/Attributes/SpaceComplexityAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ons/Attributes/TimeComplexityAttribute.cs → ...ore/Attributes/TimeComplexityAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
2 changes: 1 addition & 1 deletion
2
src/LeetCode.Solutions/Enums/Approach.cs → src/Core/Enums/Approach.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace LeetCode.Solutions.Enums | ||
namespace Core.Enums | ||
{ | ||
public enum Approach | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
src/LeetCode.Solutions/Enums/Company.cs → src/Core/Enums/Company.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace LeetCode.Solutions.Enums | ||
namespace Core.Enums | ||
{ | ||
public enum Company | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
src/LeetCode.Solutions/Enums/Level.cs → src/Core/Enums/Level.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace LeetCode.Solutions.Enums | ||
namespace Core.Enums | ||
{ | ||
public enum Level | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
namespace Core.Helpers; | ||
|
||
public class ListNode | ||
{ | ||
public int val; | ||
public ListNode next; | ||
public ListNode(int val = 0, ListNode next = default) | ||
{ | ||
this.val = val; | ||
this.next = next; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Core.Helpers; | ||
public class Node | ||
{ | ||
public int val; | ||
public IList<Node> children; | ||
|
||
public Node() { } | ||
|
||
public Node(int _val) | ||
{ | ||
val = _val; | ||
} | ||
|
||
public Node(int _val, IList<Node> _children) | ||
{ | ||
val = _val; | ||
children = _children; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
namespace Core.Helpers; | ||
|
||
public static class NodeGenerator | ||
{ | ||
public static ListNode ListNode(int[] nums) | ||
{ | ||
if (nums == null || nums.Length == 0) return null; | ||
|
||
var i = 0; | ||
var first = new ListNode(nums[i]); | ||
var current = first; | ||
|
||
while (++i < nums.Length) | ||
{ | ||
current.next = new ListNode(nums[i]); | ||
current = current.next; | ||
} | ||
|
||
return first; | ||
} | ||
|
||
public static TreeNode TreeNode(int?[] nums) | ||
{ | ||
if (nums == null || nums.Length == 0) { return null; } | ||
|
||
var i = 0; | ||
var first = new TreeNode(nums[i++].Value); | ||
var queue = new Queue<TreeNode?>(); | ||
queue.Enqueue(first); | ||
|
||
while (queue.Count > 0) | ||
{ | ||
var current = queue.Dequeue(); | ||
if (i < nums.Length && nums[i].HasValue) | ||
{ | ||
var node = new TreeNode(nums[i].Value); | ||
current.left = node; | ||
queue.Enqueue(node); | ||
} | ||
if (i + 1 < nums.Length && nums[i + 1].HasValue) | ||
{ | ||
var node = new TreeNode(nums[i + 1].Value); | ||
current.right = node; | ||
queue.Enqueue(node); | ||
} | ||
i += 2; | ||
} | ||
|
||
return first; | ||
} | ||
|
||
public static TreeLinkNode LinkTree(int?[] nums) | ||
{ | ||
if (nums == null || nums.Length == 0) { return null; } | ||
|
||
var i = 0; | ||
var first = new TreeLinkNode(nums[i++].Value); | ||
var queue = new Queue<TreeLinkNode>(); | ||
queue.Enqueue(first); | ||
|
||
while (queue.Count > 0) | ||
{ | ||
var current = queue.Dequeue(); | ||
if (i < nums.Length && nums[i].HasValue) | ||
{ | ||
var node = new TreeLinkNode(nums[i].Value); | ||
current.left = node; | ||
queue.Enqueue(node); | ||
} | ||
if (i + 1 < nums.Length && nums[i + 1].HasValue) | ||
{ | ||
var node = new TreeLinkNode(nums[i + 1].Value); | ||
current.right = node; | ||
queue.Enqueue(node); | ||
} | ||
i += 2; | ||
} | ||
|
||
return first; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
namespace Core.Helpers; | ||
|
||
public class TreeLinkNode | ||
{ | ||
public int val; | ||
public TreeLinkNode left; | ||
public TreeLinkNode right; | ||
public TreeLinkNode next; | ||
|
||
public TreeLinkNode(int x) { val = x; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
namespace Core.Helpers; | ||
public class TreeNode | ||
{ | ||
public int val; | ||
public TreeNode left; | ||
public TreeNode right; | ||
public TreeNode(int val = 0, TreeNode left = default, TreeNode right = default) | ||
{ | ||
this.val = val; | ||
this.left = left; | ||
this.right = right; | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...de/17_LetterCombinationsOfAPhoneNumber.cs → ...ns/17_LetterCombinationsOfAPhoneNumber.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
|
||
using System.Text; | ||
|
||
namespace LeetCode.Solutions; | ||
|
||
/// <summary> | ||
|
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
src/LeetCode.Solutions/LeetCode/1_TwoSum.cs → src/LeetCode.Solutions/1_TwoSum.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
using Core.Attributes; | ||
using Core.Enums; | ||
|
||
namespace LeetCode.Solutions; | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
global using Core.Attributes; | ||
global using Core.Enums; | ||
global using Core.Helpers; | ||
global using System; | ||
global using System.Collections.Generic; | ||
global using System.Linq; | ||
global using System.Text; | ||
global using LeetCode.Solutions.Attributes; | ||
global using LeetCode.Solutions.Enums; |
Binary file not shown.
Oops, something went wrong.