예제 #1
0
        static public void DayOfTheProgrammer()
        {
            int    year   = 1918;
            string result = HackerRankChallenges.DayOfTheProgrammer(year);

            Console.WriteLine($"Day of the Programmer for {year}: {result}");
        }
예제 #2
0
 static public void CompareTheTriplets()
 {
     int[] a       = { 41, 2, 3 };
     int[] b       = { 3, 2, 1 };
     int[] results = HackerRankChallenges.CompareTheTriplets(a, b);
     Console.WriteLine($"Triplet Comparison Score: Alice - {results[0]}  Bob - {results[1]}");
 }
예제 #3
0
        static public void SumArray()
        {
            int[] ar    = { 2, 4, 6, 8, 10 };
            int   total = HackerRankChallenges.SumArray(ar);

            Console.WriteLine($"Sum Array: {total}");
        }
예제 #4
0
        static public void WeightedUniformStrings()
        {
            string s = "abccddde";

            int[]    queries = { 1, 3, 12, 5, 9, 10 };
            string[] result  = HackerRankChallenges.weightedUniformStrings(s, queries);
            for (int i = 0; i < result.Length; i++)
            {
                Console.Write($"[ {result[i] } ] ");
                Console.WriteLine();
            }
        }
예제 #5
0
        static public void IceCream()
        {
            int m = 4;

            int[] cost    = new int[] { 1, 4, 5, 3, 2 };
            int[] results = HackerRankChallenges.IceCream(m, cost);
            Console.Write("IceCream Results: ");
            for (int i = 0; i < results.Length; i++)
            {
                Console.Write($"{results[i]} ");
            }
            Console.WriteLine();
        }
예제 #6
0
        static public void InsertionSortPtOne()
        {
            int n = 5;

            int[] arr = new int[] { 2, 4, 6, 8, 3 };

            Console.WriteLine("Insertion Sort Part One: ");
            for (int i = 0; i < arr.Length; i++)
            {
                Console.Write($"[{arr[i]}] ");
            }
            Console.WriteLine();
            HackerRankChallenges.InsertionSortPartOne(n, arr);
            for (int i = 0; i < arr.Length; i++)
            {
                Console.Write($"[{arr[i]}] ");
            }
            Console.WriteLine();
        }