public override string Solve() { var data = ParserFactory.CreateSingleLineStringParser().GetData(); var position = 1; var floor = 0; foreach (var c in data) { if (c == ')') { floor--; } else if (c == '(') { floor++; } if (floor == -1) { return(position.ToString()); } position++; } return("Error"); }
public override string Solve() { var directions = ParserFactory.CreateSingleLineStringParser().GetData(); var visited = new HashSet <string>(); var tracker = new DeliveryTracker(visited); foreach (var direction in directions) { tracker.Move(direction); } return(visited.Count.ToString()); }
public override string Solve() { var input = ParserFactory.CreateSingleLineStringParser().GetData(); var number = 0; for (;;) { if (Md5Stringify.GetHexCharacters($"{input}{number}").Take(6).All(c => c == '0')) { return(number.ToString()); } number++; } }
public override string Solve() { var data = ParserFactory.CreateSingleLineStringParser().GetData(); var floor = 0; foreach (var c in data) { if (c == ')') { floor--; } else if (c == '(') { floor++; } } return(floor.ToString()); }