From 2b0aee7665b915898142a61efd8cc5db832621e7 Mon Sep 17 00:00:00 2001 From: tacosontitan <65432314+tacosontitan@users.noreply.github.com> Date: Wed, 10 Apr 2024 22:02:16 -0500 Subject: [PATCH] Completed initial hussy dry run for two-sum. --- .../Leetcode/Easy/TwoSum/HussyDryRun.cs | 23 +++++++++++++++++++ .../Leetcode/Easy/TwoSum/Tests/Setup.cs | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/HussyDryRun.cs diff --git a/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/HussyDryRun.cs b/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/HussyDryRun.cs new file mode 100644 index 0000000..a5fe614 --- /dev/null +++ b/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/HussyDryRun.cs @@ -0,0 +1,23 @@ +namespace Hussy.Net.Playground.Leetcode.Easy; + +/// +/// Represents a solution and its tests for the leetcode two-sum problem. +/// +/// +public sealed partial class TwoSum +{ + /// + /// A very mundane and direct approach to solving the problem to understand where Hussy may be lacking. + /// + /// The array of numbers to look through. + /// + /// The target number which the two numbers in must add up to. + /// + /// + /// The two indices of the numbers which add up to the . + /// + private static IEnumerable? HussyDryRun( + int[] n, + int t) => + n.Fe((x, y) => x.I != y.I && x.V + y.V == t,(x, y) => new[] { x.I, y.I }); +} \ No newline at end of file diff --git a/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/Tests/Setup.cs b/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/Tests/Setup.cs index f9cac71..949993f 100644 --- a/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/Tests/Setup.cs +++ b/samples/Hussy.Net.Playground/Leetcode/Easy/TwoSum/Tests/Setup.cs @@ -14,7 +14,8 @@ public sealed partial class TwoSum DryRun, GolfedDryRun, ComplexityRun, - GolfedComplexityRun + GolfedComplexityRun, + HussyDryRun ]; ///