Exemplo n.º 1
0
        public void ThreeSum_Solutions(int[] input, string expecedJson)
        {
            var expected = JsonConvert.DeserializeObject <int[][]>(expecedJson);
            var solution = new Solution();

            var result = solution.ThreeSum(input);

            AssertEnumerable.AreEqual2DimArrays(expected, result);
        }
Exemplo n.º 2
0
        public void InsertInterval_Solutions(string intervalsStr, int[] newInterval, string expectedStr)
        {
            int[][] intervals = JsonConvert.DeserializeObject <int[][]>(intervalsStr);
            int[][] expected  = JsonConvert.DeserializeObject <int[][]>(expectedStr);

            var solution = new InsertIntervalClass();
            var result   = solution.Insert(intervals, newInterval);

            AssertEnumerable.AreEqual2DimArrays(expected, result);
        }
Exemplo n.º 3
0
        public void ThreeSum_Solutions(int maxTravelDist,
                                       string forwardRouteListJson,
                                       string returnRouteListJson,
                                       string expectedJson)
        {
            // started with brute force solution:
            // check all posible

            // optimize by sorting

            var forwardRouteList = JsonConvert.DeserializeObject <List <List <int> > >(forwardRouteListJson);
            var returnRouteList  = JsonConvert.DeserializeObject <List <List <int> > >(returnRouteListJson);
            var expected         = JsonConvert.DeserializeObject <List <List <int> > >(expectedJson);

            var result = optimalUtilization(maxTravelDist, forwardRouteList, returnRouteList);

            AssertEnumerable.AreEqual2DimArrays(expected, result);
        }