コード例 #1
0
        static void TrappingRainWater()
        {
            Console.WriteLine("42. Trapping Rain Water");
            var testObj = new TrappingRainWater.Solution();

            Console.WriteLine(testObj.Trap(new int[] { 0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1 }));
        }
コード例 #2
0
        public void MyTestMethod5()
        {
            //Arrange
            var input = new int[7] {
                9, 6, 8, 8, 5, 6, 3
            };
            var expected = 3;

            //Act
            var solver = new TrappingRainWater.Solution();
            var res    = solver.Trap(input);

            //Assert
            Assert.AreEqual(expected, res);
        }
コード例 #3
0
        public void MyTestMethod4()
        {
            //Arrange
            var input = new int[10] {
                5, 5, 1, 7, 1, 1, 5, 2, 7, 6
            };
            var expected = 23;

            //Act
            var solver = new TrappingRainWater.Solution();
            var res    = solver.Trap(input);

            //Assert
            Assert.AreEqual(expected, res);
        }
コード例 #4
0
        public void MyTestMethod2()
        {
            //Arrange
            var input = new int[4] {
                5, 4, 1, 2
            };
            var expected = 1;

            //Act
            var solver = new TrappingRainWater.Solution();
            var res    = solver.Trap(input);

            //Assert
            Assert.AreEqual(expected, res);
        }
コード例 #5
0
        public void MyTestMethod1()
        {
            //Arrange
            var input = new int[12] {
                0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1
            };
            var expected = 6;

            //Act
            var solver = new TrappingRainWater.Solution();
            var res    = solver.Trap(input);

            //Assert
            Assert.AreEqual(expected, res);
        }
コード例 #6
0
        public int TrappingRainWaterTest(int[] height)
        {
            var testObj = new TrappingRainWater.Solution();

            return(testObj.Trap(height));
        }