public override string Solve() { var frequency = 0; foreach (var line in _lines) { frequency += FrequencyParser.ParseChange(line); } return(frequency.ToString()); }
public override string Solve() { var frequency = 0; var reachedFrequencies = new HashSet <int>(); while (true) { foreach (var line in InputReader.ReadLines()) { frequency += FrequencyParser.ParseChange(line); if (reachedFrequencies.Contains(frequency)) { return(frequency.ToString()); } reachedFrequencies.Add(frequency); } } }