private static void SumOfTwoNumbersTest()
        {
            int[] list = { 10, 15, 3, 7 };

            int k = 17;

            if (SumOfTwoNumbers.IsSumOfTwoNumbers(list, k))
            {
                WriteLine($"{k} is SUM of two numbers of list {list.Print()}");
            }
            else
            {
                WriteLine($"{k} is not SUM of two numbers of list {list.Print()}");
            }

            WriteLine(new string('═', 100));
            k = 50;
            if (SumOfTwoNumbers.IsSumOfTwoNumbers(list, k))
            {
                WriteLine($"{k} is SUM of two numbers of list {list.Print()}");
            }
            else
            {
                WriteLine($"{k} is NOT SUM of two numbers of list {list.Print()}");
            }

            WriteLine(new string('═', 100));
            WriteLine($"Source List {list.Print()}");
            WriteLine($"Product of List elements excluding Index itself: {NumberProduct.Calculate(list).Print()}");

            WriteLine(new string('═', 100));
        }
        static void Main(string[] args)
        {
            int[] result = null;
            Console.WriteLine("AlgoExpert 100 algorithm questions!");
            result = SumOfTwoNumbers.TwoNumberSumSolution1(new int[] { 3, 5, -4, 8, 11, 1, -1, 6 }, 10);

            Console.WriteLine("Result");
            Console.WriteLine(result.Length);
        }
예제 #3
0
        public void Sum_TwoIntValues_ReturnSum(int num1, int num2, int expected)
        {
            var actual = SumOfTwoNumbers.Sum(num1, num2);

            Assert.Equal(expected, actual);
        }