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

            Console.WriteLine(Playground.GetShortestUniqueSubstring(arr, str));
        }
Beispiel #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);
        }
Beispiel #3
0
        public static void Test_KthSmallestFromMatrix()
        {
            int[,] nums =
            {
                {  1,  5,  9 },
                { 10, 11, 13 },
                { 12, 13, 15 }
            };

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