Skip to content

Commit fa224a1

Browse files
author
Gonzalo Diaz
committed
WIP
1 parent 831de54 commit fa224a1

32 files changed

+63
-126
lines changed

src/algorithm_exercises_csharp/Hello.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ namespace algorithm_exercises_csharp;
44

55
public class HelloWorld
66
{
7-
const string __message = "Hello World!";
7+
private readonly string __message = "Hello World!";
88

9-
[ExcludeFromCodeCoverage]
10-
protected HelloWorld() { }
11-
12-
public static string hello()
9+
public string hello()
1310
{
1411
return __message;
1512
}

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotation.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.arrays
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class ArraysLeftRotation
7+
public static class ArraysLeftRotation
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected ArraysLeftRotation() { }
11-
129
public const int FIRST_POSITION = 0;
1310

1411
/**

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/arrays/CrushBruteForce.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.arrays
55

66
using System.Diagnostics.CodeAnalysis;
77

8-
public class CrushBruteForce
8+
public static class CrushBruteForce
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected CrushBruteForce() { }
12-
1310
private const int INITIALIZER = 0;
1411

1512
public static long arrayManipulation(int n, List<List<int>> queries)

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/arrays/CrushOptimized.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.arrays
55

66
using System.Diagnostics.CodeAnalysis;
77

8-
public class CrushOptimized
8+
public static class CrushOptimized
99
{
10-
[ExcludeFromCodeCoverage]
11-
private CrushOptimized() { }
1210

1311
/**
1412
// arrayManipulation.

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/arrays/NewYearChaos.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.arrays
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class NewYearChaos
7+
public static class NewYearChaos
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected NewYearChaos() { }
11-
129
public const String TOO_CHAOTIC_ERROR = "Too chaotic";
1310

1411
/**

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/arrays/TwoDArray.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.arrays
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class TwoDArray
7+
public static class TwoDArray
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected TwoDArray() { }
11-
129
private static List<int> getHourGlass(List<List<int>> arr, int positionX, int positionY)
1310
{
1411
List<int> result = [];

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
77
using System.Diagnostics.CodeAnalysis;
88
using System.Collections.Generic;
99

10-
public class CountTriplets
10+
public static class CountTriplets
1111
{
12-
[ExcludeFromCodeCoverage]
13-
protected CountTriplets() { }
14-
1512
public static long countTriplets(List<long> arr, long r)
1613
{
1714
Dictionary<long, long> aCounter = [];

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
55
using System.Diagnostics.CodeAnalysis;
66
using System.Collections.Generic;
77

8-
public class CountTripletsBruteForce
8+
public static class CountTripletsBruteForce
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected CountTripletsBruteForce() { }
12-
1310
public static long countTriplets(List<long> arr, long r)
1411
{
1512
long size = arr.Count;

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ private FrequencyQueries()
1313
reset();
1414
}
1515

16-
private static readonly long __INITIAL__ = 1L;
16+
private const long __INITIAL__ = 1L;
1717

1818
private const int __INSERT__ = 1;
1919
private const int __DELETE__ = 2;
2020
private const int __SELECT__ = 3;
2121

22-
private static readonly int __NOT_FOUND__ = 0;
23-
private static readonly int __FOUND__ = 1;
22+
private const int __NOT_FOUND__ = 0;
23+
private const int __FOUND__ = 1;
2424

2525
readonly Dictionary<long, long> valueFreqs = [];
2626
readonly Dictionary<long, List<long>> freqDictionary = [];

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
55
using System.Diagnostics.CodeAnalysis;
66
using System.Collections.Generic;
77

8-
public class RansomNote
8+
public static class RansomNote
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected RansomNote() { }
12-
1310
public class InvalidValueException : Exception
1411
{
1512
// constructor for the InvalidAgeException class
1613
public InvalidValueException(string msg)
1714
{
1815
Console.WriteLine(msg);
1916
}
17+
18+
public InvalidValueException()
19+
{
20+
}
2021
}
2122

22-
private static readonly string __YES__ = "Yes";
23-
private static readonly string __NO__ = "No";
23+
private const string __YES__ = "Yes";
24+
private const string __NO__ = "No";
2425

2526
public static bool checkMagazineCompute(List<string> magazine, List<string> note)
2627
{

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
55
using System.Diagnostics.CodeAnalysis;
66
using System.Numerics;
77

8-
public class SherlockAndAnagrams
8+
public static class SherlockAndAnagrams
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected SherlockAndAnagrams() { }
1210

1311
/**
1412
* factorial().

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

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class TwoStrings
7+
public static class TwoStrings
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected TwoStrings() { }
11-
12-
private static readonly string __YES__ = "Yes";
13-
private static readonly string __NO__ = "No";
14-
private static readonly char __EMPTY_CHAR__ = '\0';
9+
private const string __YES__ = "Yes";
10+
private const string __NO__ = "No";
11+
private const char __EMPTY_CHAR__ = '\0';
1512

1613
public static bool twoStringsCompute(string s1, string s2)
1714
{

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.greedy
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class LuckBalance
7+
public static class LuckBalance
88
{
99
public class Competition(int _luck, int _important)
1010
{
1111
public int luck => _luck;
1212
public int important => _important;
1313
}
1414

15-
[ExcludeFromCodeCoverage]
16-
protected LuckBalance() { }
17-
1815
public static int luckBalance(int k, List<List<int>> contests)
1916
{
2017
List<Competition> important_competitions = [];

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.greedy
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class MinimumAbsoluteDifferenceInAnArray
7+
public static class MinimumAbsoluteDifferenceInAnArray
88
{
9-
[ExcludeFromCodeCoverage]
10-
private MinimumAbsoluteDifferenceInAnArray()
11-
{
12-
}
139

1410
/**
1511
* minimumAbsoluteDifference.

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/linked_list/FindMergeNode.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.linked
55

66
using System.Diagnostics.CodeAnalysis;
77

8-
public class FindMergeNode
8+
public static class FindMergeNode
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected FindMergeNode() { }
12-
1310
public static int? findMergeNode(LinkedList<int>.Node head1, LinkedList<int>.Node head2)
1411
{
1512
List<LinkedList<int>.Node> llindex = [];

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/linked_list/LinkedListCycle.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.linked
55

66
using System.Diagnostics.CodeAnalysis;
77

8-
public class LinkedListCycle
8+
public static class LinkedListCycle
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected LinkedListCycle() { }
12-
1310
public static bool hasCycle<T>(LinkedList<T>.Node? head)
1411
{
1512
List<LinkedList<T>.Node> llindex = [];

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/linked_list/lib/Node.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.linked_list.lib;
22

3-
public class LinkedList<T>
3+
public static class LinkedList<T>
44
{
55
public class Node(T nodeData)
66
{

src/algorithm_exercises_csharp/hackerrank/projecteuler/Euler001.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.projecteuler;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class Euler001
7+
public static class Euler001
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected Euler001() { }
11-
129
public static int sumOfArithmeticProgression(int n, int d)
1310
{
1411
int new_n = n / d;

src/algorithm_exercises_csharp/hackerrank/projecteuler/Euler002.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.projecteuler;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class Euler002
7+
public static class Euler002
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected Euler002() { }
11-
129
public static int fiboEvenSum(int n)
1310
{
1411
Log.info("fiboEvenSum({n})", n);

src/algorithm_exercises_csharp/hackerrank/projecteuler/Euler003.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ namespace algorithm_exercises_csharp.hackerrank.projecteuler;
66

77
using System.Diagnostics.CodeAnalysis;
88

9-
public class Euler003
9+
public static class Euler003
1010
{
11-
[ExcludeFromCodeCoverage]
12-
protected Euler003() { }
13-
1411
public static int? primeFactor(int n)
1512
{
1613
if (n < 2)

src/algorithm_exercises_csharp/hackerrank/warmup/BirthdayCakeCandles.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class BirthdayCakeCandles
7+
public static class BirthdayCakeCandles
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected BirthdayCakeCandles() { }
11-
129
public static int birthdayCakeCandles(List<int> _arr)
1310
{
1411
if (_arr.Count == 0)

src/algorithm_exercises_csharp/hackerrank/warmup/CompareTriplets.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class CompareTriplets
7+
public static class CompareTriplets
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected CompareTriplets() { }
11-
129
public static List<int> compareTriplets(List<int> _a, List<int> _b)
1310
{
1411
List<int> awards = [0, 0];

src/algorithm_exercises_csharp/hackerrank/warmup/DiagonalDifference.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class DiagonalDifference
7+
public static class DiagonalDifference
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected DiagonalDifference() { }
11-
129
public static int diagonalDifference(List<List<int>> _arr)
1310
{
1411
int diag1 = 0;

src/algorithm_exercises_csharp/hackerrank/warmup/MiniMaxSum.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class MiniMaxSum
7+
public static class MiniMaxSum
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected MiniMaxSum() { }
11-
129
public static string miniMaxSum(List<int> arr)
1310
{
1411
if (arr.Count == 0)

src/algorithm_exercises_csharp/hackerrank/warmup/PlusMinus.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
55
using System.Globalization;
66
using System.Diagnostics.CodeAnalysis;
77

8-
public class PlusMinus
8+
public static class PlusMinus
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected PlusMinus() { }
12-
1310
public static string plusMinus(List<int> arr)
1411
{
1512
int positives = 0;

src/algorithm_exercises_csharp/hackerrank/warmup/SimpleArraySum.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class SimpleArraySum
7+
public static class SimpleArraySum
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected SimpleArraySum() { }
11-
129
public static int simpleArraySum(int[] inputs)
1310
{
1411
var total = 0;

src/algorithm_exercises_csharp/hackerrank/warmup/SolveMeFirst.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class SolveMeFirst
7+
public static class SolveMeFirst
88
{
9-
[ExcludeFromCodeCoverage]
10-
protected SolveMeFirst() { }
11-
129
public static int solveMeFirst(int _a, int _b)
1310
{
1411
return _a + _b;

src/algorithm_exercises_csharp/hackerrank/warmup/Staircase.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ namespace algorithm_exercises_csharp.hackerrank.warmup;
55
using System.Text;
66
using System.Diagnostics.CodeAnalysis;
77

8-
public class Staircase
8+
public static class Staircase
99
{
10-
[ExcludeFromCodeCoverage]
11-
protected Staircase() { }
12-
1310
public static string staircase(int _n)
1411
{
1512
List<string> result = [];

0 commit comments

Comments
 (0)