Пример #1
0
        void Main()
        {
            MethodOne m = new MethodOne();
            MethodTwo m2 = new MethodTwo();

            List<ITestStrategy> strategies = new List<ITestStrategy> { new MethodOne(), new MethodTwo(), new MethodThree() };
            foreach (var strategy in strategies)
                Console.WriteLine(strategy.GetNumber());
        }
Пример #2
0
        // Given an array nums of n integers where n > 1,  return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].
        // Example:
        // Input:  [1,2,3,4]
        // Output: [24,12,8,6]
        // solve without devision

        static void Main(string[] args)
        {
            var input = new int[] { 1, 2, 3, 4 };

            Print(input);
            var output = MethodOne.Run(input);

            Print(output);

            var output2 = MethodTwo.Run(input);

            Print(output2);
        }
Пример #3
0
        void Main()
        {
            MethodOne m  = new MethodOne();
            MethodTwo m2 = new MethodTwo();

            List <ITestStrategy> strategies = new List <ITestStrategy> {
                new MethodOne(), new MethodTwo(), new MethodThree()
            };

            foreach (var strategy in strategies)
            {
                Console.WriteLine(strategy.GetNumber());
            }
        }