Exemplo n.º 1
0
        public string Solve(string[] input)
        {
            var encodingList = input.Select(a => ulong.Parse(a)).ToList();

            var encodingQueue = new Queue <ulong>(queueLength);

            for (var index = 0; index < encodingList.Count; index++)
            {
                if (encodingQueue.Count == 25)
                {
                    // Do the checks
                    var result = ArrayCheck.FindTwoValuesWithSum(encodingQueue, encodingList[index]);

                    if (result == null)
                    {
                        return(this.ProcessResult(encodingList, index).ToString());
                    }

                    encodingQueue.Dequeue();
                }

                encodingQueue.Enqueue(encodingList[index]);
            }

            return(ulong.MinValue.ToString());
        }
Exemplo n.º 2
0
        public string Solve(string[] input)
        {
            var actualArray = input.Select(a => ulong.Parse(a));

            var result = ArrayCheck.FindTwoValuesWithSum(actualArray, 2020);

            return((result.Item1 * result.Item2).ToString());

            throw new System.ArgumentException("Argument must contain two integers that sum to 2020");
        }