Beispiel #1
0
        static void Codility()
        {
            //            // Counting Elements
            //            var frogJumps = new FrogJumps();
            //            frogJumps.Solution();
            //
            //            var countingOperations = new CountingOperations();
            //            countingOperations.Solution();

            //            var missingInteger = new MissingInteger();
            //            missingInteger.Solution();

            //            var countDiv = new CountDiv();
            //            countDiv.Solution();

            //            var genomicRangeQuery = new GenomicRangeQuery();
            //            genomicRangeQuery.Solution();

            //var passingCars = new PassingCars();
            //passingCars.Solution();

            //var sorting = new MaxProductOfThree();
            //sorting.Solution();

            var numberOfDiscIntersections = new NumberOfDiscIntersections();

            numberOfDiscIntersections.Solution(new[] { 1, 5, 2, 1, 4, 0 });
        }
Beispiel #2
0
        public void ShouldDetectIntersections(int[] A, int expected)
        {
            NumberOfDiscIntersections detector = new NumberOfDiscIntersections();
            int actual = detector.Detect(A);

            Assert.AreEqual(expected, actual);
        }
        public void test_solution_givenArray_returnsNumberOfPairs(int[] given, int expected)
        {
            var target = new NumberOfDiscIntersections();
            int actual = target.solution(given);

            Assert.AreEqual(expected, actual);
        }
        public void GetNumber_Sample_11()
        {
            var solver        = new NumberOfDiscIntersections();
            var radiuses      = new[] { 1, 5, 2, 1, 4, 0 };
            var intersections = solver.GetNumber(radiuses);

            intersections.Should().Be(11);
        }
        public void GetNumber_SmallExtreme_2()
        {
            var solver        = new NumberOfDiscIntersections();
            var radiuses      = new[] { 1, 2147483647, 0 };
            var intersections = solver.GetNumber(radiuses);

            intersections.Should().Be(2);
        }
        public void NumberOfDiscIntersectionsSolutionTest()
        {
            var discs = new NumberOfDiscIntersections();

            int[] array  = { 1, 5, 2, 1, 4, 0 };
            int   result = discs.Solve(array);

            Assert.AreEqual(11, result);
        }
Beispiel #7
0
        public void Solution_SmallArray_Correct()
        {
            //Arrange - Given
            var array = new int[] { 1, 5, 2, 1, 4, 0 };

            //Act - When
            var result = NumberOfDiscIntersections.Solution(array);

            //Assert - Then
            var expectedResult = 11;

            Assert.Equal(expectedResult, result);
        }
Beispiel #8
0
        public void NumberOfDiscIntersections()
        {
            var test = new NumberOfDiscIntersections();

            test.Run();
        }