Exemple #1
0
        public static void Test()
        {
            Solution s = new Solution();

            int[] a4 = new int[] { 6, 0, 8, 2, 1, 5 };
            int[] a5 = new int[] { 9, 8, 1, 0, 1, 9, 4, 0, 4, 1 };


            int[] a6 = File.ReadAllText(".\\TestData\\_962_01.txt").Trim('[').Trim(']').Split(',').ToList().Select(s2 => Convert.ToInt32(s2)).ToArray();
            int[] a7 = File.ReadAllText(".\\TestData\\_962_02.txt").Trim('[').Trim(']').Split(',').ToList().Select(s2 => Convert.ToInt32(s2)).ToArray();


            //int[] a6 = new int[] { 5, 1, 5, 2, 5, 3, 5, 4 };

            a4.PrintList();
            Console.WriteLine(s.MaxWidthRamp(a4) + " is 4");

            a5.PrintList();
            Console.WriteLine(s.MaxWidthRamp(a5) + " is 7");

            //a6.PrintList();
            DateTime start = DateTime.Now;

            Console.WriteLine(s.MaxWidthRamp(a6));
            double during = DateTime.Now.Subtract(start).TotalMilliseconds;

            Console.WriteLine(during);

            //a6.PrintList();
            start = DateTime.Now;
            Console.WriteLine(s.MaxWidthRamp(a7));
            during = DateTime.Now.Subtract(start).TotalMilliseconds;
            Console.WriteLine(during);
        }