示例#1
0
        static void Main1(string[] args)
        {
            List <string> output = CH_01.FindPairs(new int[] { 6, 3, 4, 2, 1, 0, 5, 0 }, 6);

            TestIntToEngRomanConversion();
            TestBSearch();


            //TestReadOnlyObjSet();
            TestStringManipulations();
            //TestReadOnlyObjGet();

            TestMergeSort();


            Test_BitManipulation();

            TestGreatestCommonDivisor();

            TestSetZeroInMatrix();
            TestMatrixRotation();

            TestXctSumSubarray();

            Test_FindMAxSubmatrix();

            TestKadanesAlgo();

            TestCh01();

            Test_PrintSpiralMatrix();

            Console.Read();
        }
示例#2
0
 private static void TestMatrixRotation()
 {
     int[,] mtrx = new int[2, 3] {
         { 1, 2, 3 }, { 4, 5, 6 }
     };
     Console.WriteLine(CH_01.RotateMatrix90DegreeClockwise(mtrx));
     Console.WriteLine(CH_01.RotateMatrix90DegreeAntiClockwise(mtrx));
 }
示例#3
0
        static void TestCh01()
        {
            // Question 1
            Console.WriteLine(CH_01.HasUniqueChar_WithoutBuffer("hello"));

            //Q 2
            Console.WriteLine(CH_01.RevertCStyleString("India"));
            Console.WriteLine(CH_01.RevertCStyleString(" "));
            Console.WriteLine(CH_01.RevertCStyleString(null));
            Console.WriteLine(CH_01.RevertCStyleString("*"));
        }
示例#4
0
        private static void TestSetZeroInMatrix()
        {
            int[,] mtrx = new int[3, 3] {
                { 1, 2, 0 }, { 4, 5, 0 }, { 7, 0, 9 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));
            Console.WriteLine();
            mtrx = new int[3, 3] {
                { 1, 2, 0 }, { 4, 5, 6 }, { 7, 0, 9 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));
            Console.WriteLine();
            mtrx = new int[3, 3] {
                { 1, 2, 3 }, { 4, 5, 6 }, { 0, 8, 9 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));

            Console.WriteLine();
            mtrx = new int[3, 3] {
                { 1, 2, 3 }, { 4, 0, 6 }, { 7, 8, 9 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));

            Console.WriteLine();
            mtrx = new int[3, 3] {
                { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));

            Console.WriteLine();
            mtrx = new int[1, 3] {
                { 0, 2, 0 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));

            Console.WriteLine();
            mtrx = new int[1, 3] {
                { 1, 2, 3 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));

            Console.WriteLine();
            mtrx = new int[3, 1] {
                { 1 }, { 4 }, { 7 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));

            Console.WriteLine();
            mtrx = new int[3, 1] {
                { 1 }, { 4 }, { 0 }
            };
            Console.WriteLine(CH_01.SetRowColWithZeroCrossing(mtrx));
        }