コード例 #1
0
 private static bool SlicesAreEqual(Solution.Slice a, Solution.Slice b)
 {
     return a.MinIndex == b.MinIndex
         && a.MaxIndex == b.MaxIndex
         && a.Sum == b.Sum
         && a.SliceLength == b.SliceLength
         && a.MaxValueInSlice == b.MaxValueInSlice;
 }
コード例 #2
0
        public void Solution2_Example()
        {
            var A = new[] { -2, -2, 6, -1, -9, -3, 1, 6 };
            var expected = 13;

            var actual = new Solution().solution(A);

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void Solution3_Example()
        {
            var A = new[] { -6, -6, 1, 7, 6, -3, 6, 0 };
            var expected = 20;

            var actual = new Solution().solution(A);

            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void Solution1_Example()
        {
            var A = new[] { 3, 2, -6, 3, 1 };
            var expected = 9;

            var actual = new Solution().solution(A);

            Assert.AreEqual(expected, actual);
        }