示例#1
0
        /*
         * Input: trips = [[2,1,5],[3,3,7]], capacity = 4Output: false
         *
         * Input: trips = [[2,1,5],[3,3,7]], capacity = 5Output: true
         *
         * Input: trips = [[3,2,7],[3,7,9],[8,3,9]], capacity = 11Output: true
         */
        static void Main(string[] args)
        {
            int[][] trips    = new int[][] { new int[] { 3, 2, 7 }, new int[] { 3, 7, 9 }, new int[] { 8, 3, 9 } };
            int     capacity = 11;
            CarPool car      = new CarPool();

            Console.WriteLine(car.EvaluateTravel(trips, capacity));
            Console.ReadKey();
        }
示例#2
0
        public void CarPool_TakeThreeTrips_WithRequiredCapacity_ShouldSucess()
        {
            int[][] trips      = new int[][] { new int[] { 3, 2, 7 }, new int[] { 3, 7, 9 }, new int[] { 8, 3, 9 } };
            int     capacity   = 11;
            CarPool car        = new CarPool();
            bool    takeTravel = car.EvaluateTravel(trips, capacity);

            Assert.True(takeTravel);
        }
示例#3
0
        public void CarPool_TakeOneTrip_Success()
        {
            int[][] trips      = new int[][] { new int[] { 3, 2, 7 } };
            int     capacity   = 11;
            CarPool car        = new CarPool();
            bool    takeTravel = car.EvaluateTravel(trips, capacity);

            Assert.True(takeTravel);
        }
示例#4
0
        public void CarPool_TakeTwoTrips_WithMoreThanCapacity_ShouldFails()
        {
            int[][] trips      = new int[][] { new int[] { 2, 1, 5 }, new int[] { 3, 3, 7 } };
            int     capacity   = 4;
            CarPool car        = new CarPool();
            bool    takeTravel = car.EvaluateTravel(trips, capacity);

            Assert.False(takeTravel);
        }