From be4fb7b4ea135b8a1d5b1488a91fa5683bda471c Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Mon, 2 Sep 2024 22:26:51 -0400 Subject: [PATCH 1/8] [CONFIG] .NET C# code lint enforced. --- .vscode/settings.json | 1 + .../algorithm_exercises_csharp.csproj | 8 ++++++++ .../algorithm_exercises_csharp_base.csproj | 5 +++++ .../algorithm_exercises_csharp_test.csproj | 8 ++++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a2b0918..efc2a83 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,7 @@ "[csharp]": { "editor.defaultFormatter": "ms-dotnettools.csharp" }, + "omnisharp.enableEditorConfigSupport": true, "[github-actions-workflow]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, diff --git a/algorithm_exercises_csharp/algorithm_exercises_csharp.csproj b/algorithm_exercises_csharp/algorithm_exercises_csharp.csproj index bfec5ef..98b5e69 100644 --- a/algorithm_exercises_csharp/algorithm_exercises_csharp.csproj +++ b/algorithm_exercises_csharp/algorithm_exercises_csharp.csproj @@ -10,6 +10,7 @@ true + latest true false @@ -18,4 +19,11 @@ + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + diff --git a/algorithm_exercises_csharp_base/algorithm_exercises_csharp_base.csproj b/algorithm_exercises_csharp_base/algorithm_exercises_csharp_base.csproj index 418d63c..75d5a30 100644 --- a/algorithm_exercises_csharp_base/algorithm_exercises_csharp_base.csproj +++ b/algorithm_exercises_csharp_base/algorithm_exercises_csharp_base.csproj @@ -12,6 +12,7 @@ true + latest true false @@ -23,6 +24,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj index a7a60e3..de62967 100644 --- a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj +++ b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj @@ -19,6 +19,7 @@ true + latest true false @@ -29,6 +30,10 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + @@ -50,8 +55,7 @@ - + From d234b7b6fb236e86f4b2ef79f7c3ad58fc52a065 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Mon, 2 Sep 2024 20:21:14 -0400 Subject: [PATCH 2/8] [FIX] Logger method typo fixed. --- algorithm_exercises_csharp_base/src/Logger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithm_exercises_csharp_base/src/Logger.cs b/algorithm_exercises_csharp_base/src/Logger.cs index bff9c3b..a061312 100644 --- a/algorithm_exercises_csharp_base/src/Logger.cs +++ b/algorithm_exercises_csharp_base/src/Logger.cs @@ -68,7 +68,7 @@ public static void error(string message, params object?[] args) #pragma warning restore CA2254 // Template should be a static expression } - public static void debu(string message, params object?[] args) + public static void debug(string message, params object?[] args) { #pragma warning disable CA2254 // Template should be a static expression LoggerSingleton.Instance.Logger.LogDebug(message); From aad35a45b5404613af3bd34c1cc1f851545c7c99 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Mon, 2 Sep 2024 16:49:11 -0400 Subject: [PATCH 3/8] [Hacker Rank] Interview Preparation Kit: Arrays: Documentation link FIXED. Documentation updated. --- .../interview_preparation_kit/arrays/ArraysLeftRotation.cs | 2 +- .../arrays/ctci_array_left_rotation.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/algorithm_exercises_csharp/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.cs b/algorithm_exercises_csharp/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.cs index 7429ed6..5079f0a 100644 --- a/algorithm_exercises_csharp/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.cs +++ b/algorithm_exercises_csharp/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.cs @@ -1,4 +1,4 @@ -// @link Problem definition [[docs/hackerrank/projecteuler/euler001.md]] +// @link Problem definition [[docs/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.md]] namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit; diff --git a/docs/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.md b/docs/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.md index 7b4e341..4f5c0e9 100644 --- a/docs/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.md +++ b/docs/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.md @@ -2,8 +2,8 @@ Given an array and a number, d, perform d left rotations on the array. -- Difficulty: #easy -- Category: #ProblemSolvingBasic +- Difficulty: `#easy` +- Category: `#ProblemSolvingBasic` `#arrays` A left rotation operation on an array shifts each of the array's elements $ 1 $ unit to the left. For example, if $ 2 $ left rotations are performed From f5ee69f857876bca24179292eee13bf0ebd1f809 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Tue, 3 Sep 2024 13:12:53 -0400 Subject: [PATCH 4/8] [FIX] New utility to encapsulate JSON loading --- .../src/lib/JsonLoader.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 algorithm_exercises_csharp_test/src/lib/JsonLoader.cs diff --git a/algorithm_exercises_csharp_test/src/lib/JsonLoader.cs b/algorithm_exercises_csharp_test/src/lib/JsonLoader.cs new file mode 100644 index 0000000..d4a0464 --- /dev/null +++ b/algorithm_exercises_csharp_test/src/lib/JsonLoader.cs @@ -0,0 +1,32 @@ +namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit; + +using System.Reflection; +using System.Text; +using Newtonsoft.Json; + +public static class JsonLoader +{ + public static T? resourceLoad(string _path) + { + string path = _path; + path = path.Replace('/', '.'); + path = path.Replace('\\', '.'); + + var info = Assembly.GetExecutingAssembly().GetName(); + var name = info.Name; + + path = $"{name}.Resources.{path}"; + Log.debug($"Loading JSON from: {path}"); + + using var stream = Assembly + .GetExecutingAssembly() + .GetManifestResourceStream($"{path}")!; + + + using var streamReader = new StreamReader(stream, Encoding.UTF8); + + return JsonConvert.DeserializeObject( + streamReader.ReadToEnd() + ); + } +} From 1599ea2e63db7ef39ced16507be6b86fdaa6ebae Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Mon, 2 Sep 2024 20:26:28 -0400 Subject: [PATCH 5/8] [REFACTOR] [Hacker Rank] Interview Preparation Kit: Arrays: Left Rotation. Load test case data from JSON. JSON load as Resource: https://khalidabuhakmeh.com/how-to-use-embedded-resources-in-dotnet --- .../ctci_array_left_rotation.testcases.json | 7 ++++++ .../algorithm_exercises_csharp_test.csproj | 3 +++ .../arrays/ArraysLeftRotation.Test.cs | 25 +++++++++++-------- 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.testcases.json diff --git a/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.testcases.json b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.testcases.json new file mode 100644 index 0000000..1750d96 --- /dev/null +++ b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.testcases.json @@ -0,0 +1,7 @@ +[ + {"input": [1, 2, 3, 4, 5], "expected": [2, 3, 4, 5, 1]}, + {"input": [2, 3, 4, 5, 1], "expected": [3, 4, 5, 1, 2]}, + {"input": [3, 4, 5, 1, 2], "expected": [4, 5, 1, 2, 3]}, + {"input": [4, 5, 1, 2, 3], "expected": [5, 1, 2, 3, 4]}, + {"input": [5, 1, 2, 3, 4], "expected": [1, 2, 3, 4, 5]} +] diff --git a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj index de62967..ceb50d6 100644 --- a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj +++ b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj @@ -58,4 +58,7 @@ + + + diff --git a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.Test.cs b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.Test.cs index d099eef..266d29c 100644 --- a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.Test.cs +++ b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.Test.cs @@ -5,32 +5,37 @@ public class ArraysLeftRotationTest { public class ArraysLeftRotationTestCase { - public List input = []; public List expected = []; + public List input { get; set; } = default!; + public List expected { get; set; } = default!; } public class ArraysLeftRotationsTestCase { - public List input = []; public int d; public List expected = []; + public List input { get; set; } = default!; + public int d { get; set; } + public List expected { get; set; } = default!; } - private static readonly ArraysLeftRotationTestCase[] tests = [ - new() { input = [1, 2, 3, 4, 5], expected = [2, 3, 4, 5, 1] }, - new() { input = [2, 3, 4, 5, 1], expected = [3, 4, 5, 1, 2] }, - new() { input = [3, 4, 5, 1, 2], expected = [4, 5, 1, 2, 3] }, - new() { input = [4, 5, 1, 2, 3], expected = [5, 1, 2, 3, 4] }, - new() { input = [5, 1, 2, 3, 4], expected = [1, 2, 3, 4, 5] } - ]; + private List testCases { get; set; } = default!; private static readonly ArraysLeftRotationsTestCase[] testRotationsCases = [ new() { input = [1, 2, 3, 4, 5], d = 4, expected = [5, 1, 2, 3, 4] } ]; + [TestInitialize] + public void testInitialize() + { + testCases = JsonLoader.resourceLoad>( + "hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.testcases.json" + ) ?? []; + } + [TestMethod] public void testRotLeftOne() { List result; - foreach (ArraysLeftRotationTestCase test in tests) + foreach (ArraysLeftRotationTestCase test in testCases) { result = ArraysLeftRotation.rotLeftOne(test.input); CollectionAssert.AreEquivalent(test.expected, result); From 1286c4170dc0eba4846b90d8f6134e48d0f62c8d Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Tue, 3 Sep 2024 12:55:46 -0400 Subject: [PATCH 6/8] [REFACTOR] [Hacker Rank] Interview Preparation Kit: Dictionaries and Hashmaps: Hash Tables: Ransom Note. Load test case data from JSON. JSON load as Resource: https://khalidabuhakmeh.com/how-to-use-embedded-resources-in-dotnet --- .../ctci_ransom_note.testcases.json | 20 +++++++++ .../algorithm_exercises_csharp_test.csproj | 1 + .../RansomNote.Test.cs | 43 ++++++------------- 3 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/ctci_ransom_note.testcases.json diff --git a/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/ctci_ransom_note.testcases.json b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/ctci_ransom_note.testcases.json new file mode 100644 index 0000000..8f04948 --- /dev/null +++ b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/ctci_ransom_note.testcases.json @@ -0,0 +1,20 @@ +[ + { + "title": "Sample Test Case 0", + "magazine": ["give", "me", "one", "grand", "today", "night"], + "note": ["give", "one", "grand", "today"], + "expected": "Yes" + }, + { + "title": "Sample Test Case 1", + "magazine": ["two", "times", "three", "is", "not", "four"], + "note": ["two", "times", "two", "is", "four"], + "expected": "No" + }, + { + "title": "Sample Test", + "magazine": ["two", "two", "times", "three", "is", "not", "four"], + "note": ["two", "times", "two", "is", "four"], + "expected": "Yes" + } +] diff --git a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj index ceb50d6..095b995 100644 --- a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj +++ b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj @@ -60,5 +60,6 @@ + diff --git a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNote.Test.cs b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNote.Test.cs index fd6f193..188cc1b 100644 --- a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNote.Test.cs +++ b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNote.Test.cs @@ -5,47 +5,28 @@ public class RansomNoteTest { public class RansomNoteTestCase { - public string title = ""; - public List magazine = []; - public List note = []; - public string expected = ""; + public string title { get; set; } = default!; + public List magazine { get; set; } = default!; + public List note { get; set; } = default!; + public string expected { get; set; } = default!; } - public class ArraysLeftRotationsTestCase + private List testCases { get; set; } = default!; + + [TestInitialize] + public void testInitialize() { - public List input = []; public int d; public List expected = []; + testCases = JsonLoader.resourceLoad>( + "hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/ctci_ransom_note.testcases.json" + ) ?? []; } - private static readonly RansomNoteTestCase[] tests = [ - new() - { - title = "Sample Test Case 0", - magazine = ["give", "me", "one", "grand", "today", "night"], - note = ["give", "one", "grand", "today"], - expected = "Yes" - }, - new() - { - title = "Sample Test Case 1", - magazine = ["two", "times", "three", "is", "not", "four"], - note = ["two", "times", "two", "is", "four"], - expected = "No" - }, - new() - { - title = "Sample Test", - magazine = ["two", "two", "times", "three", "is", "not", "four"], - note = ["two", "times", "two", "is", "four"], - expected = "Yes" - }, - ]; - [TestMethod] public void testCheckMagazine() { string result; - foreach (RansomNoteTestCase test in tests) + foreach (RansomNoteTestCase test in testCases) { result = RansomNote.checkMagazine(test.magazine, test.note); Assert.AreEqual(test.expected, result); From ad7622d6a3a3fcfe85b78ddfc4415ef96a066687 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Tue, 3 Sep 2024 12:58:03 -0400 Subject: [PATCH 7/8] [REFACTOR] [Hacker Rank] Interview Preparation Kit: Dictionaries and Hashmaps: Two Strings. Load test case data from JSON. JSON load as Resource: https://khalidabuhakmeh.com/how-to-use-embedded-resources-in-dotnet --- .../two_strings.testcases.json | 20 +++++++++ .../algorithm_exercises_csharp_test.csproj | 1 + .../TwoStrings.Test.cs | 45 +++++++------------ 3 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.testcases.json diff --git a/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.testcases.json b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.testcases.json new file mode 100644 index 0000000..73d1dcf --- /dev/null +++ b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.testcases.json @@ -0,0 +1,20 @@ +[ + { + "title": "Example 1", + "s1": "and", + "s2": "art", + "expected": "Yes" + }, + { + "title": "Example 2", + "s1": "be", + "s2": "cat", + "expected": "No" + }, + { + "title": "Sample Test Case 0", + "s1": "hello", + "s2": "world", + "expected": "Yes" + } +] diff --git a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj index 095b995..2405c42 100644 --- a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj +++ b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj @@ -61,5 +61,6 @@ + diff --git a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/TwoStrings.Test.cs b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/TwoStrings.Test.cs index 5f653e4..6ed4bb8 100644 --- a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/TwoStrings.Test.cs +++ b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/TwoStrings.Test.cs @@ -5,42 +5,31 @@ public class TwoStringsTest { public class TwoStringsTestCase { - public string title = ""; - public string s1 = ""; - public string s2 = ""; - public string expected = "Yes"; + public string title { get; set; } = default!; + + public string s1 { get; set; } = default!; + + public string s2 { get; set; } = default!; + + public string expected { get; set; } = default!; } - private static readonly TwoStringsTestCase[] tests = [ - new() - { - title = "Example 1", - s1 = "and", - s2 = "art", - expected = "Yes" - }, - new() - { - title = "Example 2", - s1 = "be", - s2 = "cat", - expected = "No" - }, - new() - { - title = "Sample Test Case 0", - s1 = "hello", - s2 = "world", - expected = "Yes" - }, - ]; + private List testCases { get; set; } = default!; + + [TestInitialize] + public void testInitialize() + { + testCases = JsonLoader.resourceLoad>( + "hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/two_strings.testcases.json" + ) ?? []; + } [TestMethod] public void testTwoStrings() { string result; - foreach (TwoStringsTestCase test in tests) + foreach (TwoStringsTestCase test in testCases) { result = TwoStrings.twoStrings(test.s1, test.s2); Assert.AreEqual(test.expected, result); From 4f26bf6f03da5fb4398ab3a2d8fa5135d7d54327 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Tue, 3 Sep 2024 14:55:59 -0400 Subject: [PATCH 8/8] [REFACTOR] [Hacker Rank] Interview Preparation Kit: Greedy Algorithms: Luck Balance. Load test case data from JSON. JSON load as Resource: https://khalidabuhakmeh.com/how-to-use-embedded-resources-in-dotnet --- .../luck_balance.testcases.json | 8 +++++ .../algorithm_exercises_csharp_test.csproj | 1 + .../greedy_algorithms/LuckBalance.Test.cs | 34 ++++++------------- 3 files changed, 19 insertions(+), 24 deletions(-) create mode 100644 algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/greedy_algorithms/luck_balance.testcases.json diff --git a/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/greedy_algorithms/luck_balance.testcases.json b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/greedy_algorithms/luck_balance.testcases.json new file mode 100644 index 0000000..99e0243 --- /dev/null +++ b/algorithm_exercises_csharp_test/Resources/hackerrank/interview_preparation_kit/greedy_algorithms/luck_balance.testcases.json @@ -0,0 +1,8 @@ +[ + { + "title": "Sample Test case 0", + "k": 3, + "contests": [[5, 1], [2, 1], [1, 1], [8, 1], [10, 0], [5, 0]], + "expected": 29 + } +] diff --git a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj index 2405c42..bd0d89b 100644 --- a/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj +++ b/algorithm_exercises_csharp_test/algorithm_exercises_csharp_test.csproj @@ -62,5 +62,6 @@ + diff --git a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/greedy_algorithms/LuckBalance.Test.cs b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/greedy_algorithms/LuckBalance.Test.cs index 4192838..a1b44ab 100644 --- a/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/greedy_algorithms/LuckBalance.Test.cs +++ b/algorithm_exercises_csharp_test/src/hackerrank/interview_preparation_kit/greedy_algorithms/LuckBalance.Test.cs @@ -11,36 +11,22 @@ public class LuckBalanceTestCase public int expected; } - private static readonly LuckBalanceTestCase[] tests = [ - new() - { - title = "Sample Test case 0", - k = 3, - contests = [[5, 1], [2, 1], [1, 1], [8, 1], [10, 0], [5, 0]], - expected = 29 - }, - new() - { - title = "Sample Test case 1", - k = 5, - contests = [[13, 1], [10, 1], [9, 1], [8, 1], [13, 1], [12, 1], [18, 1], [13, 1]], - expected = 42 - }, - new() - { - title = "Sample Test case 2", - k = 2, - contests = [[5, 1], [4, 0], [6, 1], [2, 1], [8, 0]], - expected = 21 - } - ]; + private List testCases { get; set; } = default!; + + [TestInitialize] + public void testInitialize() + { + testCases = JsonLoader.resourceLoad>( + "hackerrank/interview_preparation_kit/greedy_algorithms/luck_balance.testcases.json" + ) ?? []; + } [TestMethod] public void testLuckBalance() { int result; - foreach (LuckBalanceTestCase test in tests) + foreach (LuckBalanceTestCase test in testCases) { result = LuckBalance.luckBalance(test.k, test.contests); Assert.AreEqual(