Skip to content

Commit 5b4c42c

Browse files
author
Gonzalo Diaz
committed
WIP
1 parent 388e686 commit 5b4c42c

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNote.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public InvalidValueException(string message, Exception innerException) : base(me
2929

3030
public static bool checkMagazineCompute(List<string> magazine, List<string> note)
3131
{
32+
ArgumentNullException.ThrowIfNull(magazine);
33+
ArgumentNullException.ThrowIfNull(note);
34+
3235
Dictionary<string, int> dictionary = [];
3336

3437
foreach (string word in magazine)

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/greedy_algorithms/MinimumAbsoluteDifferenceInAnArray.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public static class MinimumAbsoluteDifferenceInAnArray
1111
*/
1212
public static int minimumAbsoluteDifference(List<int> arr)
1313
{
14+
ArgumentNullException.ThrowIfNull(arr);
15+
1416
List<int> sortedNums = [.. arr.ConvertAll(x => x).OrderBy(x => x).ToList()];
1517

1618
// Find the minimum absolute difference

src/algorithm_exercises_csharp/hackerrank/warmup/BirthdayCakeCandles.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public static class BirthdayCakeCandles
88
{
99
public static int birthdayCakeCandles(List<int> _arr)
1010
{
11+
ArgumentNullException.ThrowIfNull(_arr);
12+
1113
if (_arr.Count == 0)
1214
{
1315
throw new ArgumentException("Parameter cannot be empty", nameof(_arr));

src/algorithm_exercises_csharp/hackerrank/warmup/CompareTriplets.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ public static class CompareTriplets
88
{
99
public static List<int> compareTriplets(List<int> _a, List<int> _b)
1010
{
11+
ArgumentNullException.ThrowIfNull(_a);
12+
ArgumentNullException.ThrowIfNull(_b);
13+
1114
List<int> awards = [0, 0];
1215

1316
for (int i = 0; i < _a.Count; i++)

src/algorithm_exercises_csharp/hackerrank/warmup/DiagonalDifference.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public static class DiagonalDifference
88
{
99
public static int diagonalDifference(List<List<int>> _arr)
1010
{
11+
ArgumentNullException.ThrowIfNull(_arr);
12+
1113
int diag1 = 0;
1214
int diag2 = 0;
1315
int last = _arr.Count - 1;

0 commit comments

Comments
 (0)