public static void Run()
 {
     // warms up the methods
     Question1.Answer(0.0, 0.0, 0.0);
     Question2.Answer(new int[] { 0 }, new int[] { 0 }, new int[] { 0 });
     Question3.Answer(new int[] { 0 }, new int[] { 0 });
     Question4.Answer(new int[] { 0 }, new int[] { 0 }, 0);
     Question5.Answer(new int[] { 0 });
     Question6.Answer(new string[] { "AA", "AA" });
 }
Exemplo n.º 2
0
        TimedAnswer <int> getFifthAnwser(Test <StructuredTrades> test)
        {
            var timer = new Stopwatch();

            var structuredTrades = test.GetInput();

            timer.Start();

            var answer = Question5.Answer(structuredTrades.allowedAllocations, structuredTrades.totalValue);

            timer.Stop();

            var timeTaken = ((double)timer.ElapsedTicks / Stopwatch.Frequency) * 1000000000;

            return(new TimedAnswer <int>(answer, timeTaken));
        }
Exemplo n.º 3
0
        Answer getFifthAnswer(int[] input, TestCase test)
        {
            var timer = new Stopwatch();

            timer.Start();

            var answer = Question5.Answer(input);

            timer.Stop();

            var timeTaken = ((double)timer.ElapsedTicks / Stopwatch.Frequency) * 1000000000;

            return(new Answer()
            {
                questionNumber = 5,
                testNumber = test.testNumber,
                correct = answer == test.output ? "CORRECT" : "INCORRECT",
                speed = timeTaken
            });
        }
        Answer getFifthAnswer(StructuredTrades input, TestCase test)
        {
            var timer = new Stopwatch();

            timer.Start();

            var answer = Question5.Answer(input.allowedAllocations, input.totalValue);

            timer.Stop();

            var timeTaken = ((double)timer.ElapsedTicks / Stopwatch.Frequency) * 1000000000;

            return new Answer()
            {
                questionNumber = 5,
                testNumber = test.testNumber,
                correct = answer == test.output ? "CORRECT" : "INCORRECT",
                speed = timeTaken
            };
        }