Exemple #1
0
        public void Test_1()
        {
            var array = new int[] { 1 };

            var result = LongestSubarray.LongestSubArrayThatAddsToTheGivenSum(array, 1);

            Assert.AreEqual(1, result);

            result = LongestSubarray.LongestSubArrayThatAddsToTheGivenSum(array, 2);
            Assert.AreEqual(0, result);
        }
Exemple #2
0
        public void Test_3()
        {
            var array = new int[] { 1, -1, 1 };

            var result = LongestSubarray.LongestSubArrayThatAddsToTheGivenSum(array, 1);

            Assert.AreEqual(3, result);

            result = LongestSubarray.LongestSubArrayThatAddsToTheGivenSum(array, 0);
            Assert.AreEqual(2, result);
        }