public KnotHashResult CalculatePart2( CircularList circularList, string inputLengths) { var bytes = Encoding.ASCII.GetBytes(inputLengths).Select(x => (int)x).ToList(); bytes.AddRange(new[] { 17, 31, 73, 47, 23 }); for (var i = 0; i < 64; i++) { foreach (var inputLength in bytes) { if (!circularList.IsValidLength(inputLength)) { continue; } circularList.Reverse(inputLength); circularList.Move(inputLength); circularList.IncreaseSkipSize(); } } return(new KnotHashResult { FirstTwoNumbersMultiplied = circularList.GetFirstTwoValuesMultiplied() }); }
public KnotHashResult Calculate( CircularList circularList, int[] inputLengths) { foreach (var inputLength in inputLengths) { if (!circularList.IsValidLength(inputLength)) { continue; } circularList.Reverse(inputLength); circularList.Move(inputLength); circularList.IncreaseSkipSize(); } return(new KnotHashResult { FirstTwoNumbersMultiplied = circularList.GetFirstTwoValuesMultiplied() }); }