Skip to content

Commit

Permalink
refactor project
Browse files Browse the repository at this point in the history
  • Loading branch information
ianoflynnautomation committed Nov 2, 2024
1 parent aef5d1c commit 4b0c1ae
Show file tree
Hide file tree
Showing 188 changed files with 852 additions and 261 deletions.
58 changes: 58 additions & 0 deletions LeetCode.sln
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Core.Enums;

namespace LeetCode.Solutions.Attributes;
namespace Core.Attributes;

[System.AttributeUsage(System.AttributeTargets.Method)]
public class ApproachAttribute : System.Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

namespace LeetCode.Solutions.Attributes;
using Core.Enums;

namespace Core.Attributes;

[System.AttributeUsage(System.AttributeTargets.Class)]
public class CompaniesAttribute : System.Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Core.Enums;

namespace LeetCode.Solutions.Attributes;
namespace Core.Attributes;

[System.AttributeUsage(System.AttributeTargets.Class)]
public class LevelAttribute : System.Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace LeetCode.Solutions.Attributes;
namespace Core.Attributes;

[System.AttributeUsage(System.AttributeTargets.Method)]
public class SpaceComplexityAttribute : System.Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace LeetCode.Solutions.Attributes;
namespace Core.Attributes;

[System.AttributeUsage(System.AttributeTargets.Method)]
public class TimeComplexityAttribute : System.Attribute
Expand Down
9 changes: 9 additions & 0 deletions src/Core/Core.csproj
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>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LeetCode.Solutions.Enums
namespace Core.Enums
{
public enum Approach
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LeetCode.Solutions.Enums
namespace Core.Enums
{
public enum Company
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LeetCode.Solutions.Enums
namespace Core.Enums
{
public enum Level
{
Expand Down
14 changes: 14 additions & 0 deletions src/Core/Helpers/ListNode.cs
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;
}
}

20 changes: 20 additions & 0 deletions src/Core/Helpers/Node.cs
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;
}

}
81 changes: 81 additions & 0 deletions src/Core/Helpers/NodeGenerator.cs
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;
}
}
13 changes: 13 additions & 0 deletions src/Core/Helpers/TreeLinkNode.cs
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; }

}
15 changes: 15 additions & 0 deletions src/Core/Helpers/TreeNode.cs
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.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

using System.Text;

namespace LeetCode.Solutions;

/// <summary>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Core.Attributes;
using Core.Enums;

namespace LeetCode.Solutions;

Expand Down
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.
4 changes: 4 additions & 0 deletions src/LeetCode.Solutions/LeetCode.Solutions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>

</Project>
15 changes: 0 additions & 15 deletions src/LeetCode.Solutions/ListNode.cs

This file was deleted.

23 changes: 0 additions & 23 deletions src/LeetCode.Solutions/Node.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/LeetCode.Solutions/TreeLinkNode.cs

This file was deleted.

17 changes: 0 additions & 17 deletions src/LeetCode.Solutions/TreeNode.cs

This file was deleted.

8 changes: 6 additions & 2 deletions src/LeetCode.Solutions/Usings.cs
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 removed src/LeetCode.Tests/.DS_Store
Binary file not shown.
Loading

0 comments on commit 4b0c1ae

Please sign in to comment.