Exemple #1
0
        public static void Test_SmallestSubarray()
        {
            char[] arr = { 'x', 'y', 'z' };
            string str = "xyyzyzyx";

            Console.WriteLine(Playground.GetShortestUniqueSubstring(arr, str));
        }
Exemple #2
0
        public static void Test_ReverseWord()
        {
            char[] s = "the sky is blue".ToCharArray();
            Playground.ReverseSentence(s);

            char[] s1 = "Vande matram   ".ToCharArray();
            Playground.ReverseSentence(s1);
        }
Exemple #3
0
        public static void Test_KthSmallestFromMatrix()
        {
            int[,] nums =
            {
                {  1,  5,  9 },
                { 10, 11, 13 },
                { 12, 13, 15 }
            };

            Console.WriteLine(Playground.KthSmallest(nums, 8));
        }
Exemple #4
0
        public static void Test_Playground()
        {
            Test_TowerOfHanoi();

            int[] nums2 = { 1, 1, 1, 2, 2, 3 };
            Console.WriteLine("Remove duplicatesII length:{0}", Playground.RemoveDuplicatesII(nums2));

            Console.WriteLine(Playground.HammingDistance(1, 4));

            int[] nums1 = new int[10];
            Console.WriteLine(Playground.Fibonacci_DP(6, nums1));

            int[] nums = { 1, 2, 3 };
            Playground.Permute(nums);
        }
Exemple #5
0
        public static void Test_MatrixRotation()
        {
            int[,] nums =
            {
                { 1, 2 },
                { 3, 4 }
            };
            Playground.RotateMatrix(nums);

            int[,] nums1 =
            {
                { 1, 2, 3 },
                { 4, 5, 6 },
                { 7, 8, 9 }
            };
            Playground.RotateMatrix(nums1);
        }
Exemple #6
0
 public static void Test_Factorial()
 {
     Console.WriteLine(Playground.FirstFactorial(4));
     Console.WriteLine(Playground.FirstFactorial(8));
 }
Exemple #7
0
 public static void Test_RotateArray()
 {
     int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     Playground.RotateArray(nums, 3);
 }
Exemple #8
0
 public static void Test_TwoSum()
 {
     int[] nums = { 2, 7, 11, 15 };
     Playground.TwoSum(nums, 9);
 }
Exemple #9
0
 public static void Test_RandomizeArray()
 {
     int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8 };
     Playground.RandomizeArray(nums);
 }
Exemple #10
0
 public static void Test_RemoveArrayElementOccurence()
 {
     int[] nums = { 5, 3, 7, 11, 2, 3, 13, 5, 7 };
     Console.WriteLine(Playground.RemoveArrayElementOccurence(nums, 3));
 }
Exemple #11
0
 public static void Test_FibDP()
 {
     Console.WriteLine(Playground.Fib_DP(30, new int[31]));
 }
Exemple #12
0
 public static void Test_CountnSay()
 {
     Playground.CountAndSay(4);
 }
Exemple #13
0
 public static void Test_Subset()
 {
     int[] nums = { 1, 2, 3 };
     Playground.Subsets(nums);
 }