コード例 #1
0
ファイル: ThreeSum.cs プロジェクト: viktordd/HackerRank
        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);
        }
コード例 #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);
        }
コード例 #3
0
ファイル: ThreeSum2.cs プロジェクト: viktordd/HackerRank
        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);
        }