Ejemplo n.º 1
0
        public static int Solve(IEnumerable <string> passwords)
        {
            var lines = PasswordLine.LinesFrom(passwords);

            return(lines.Count(x => x.Password[x.PolicyRuleInt1 - 1] == x.Character ^
                               x.Password[x.PolicyRuleInt2 - 1] == x.Character));
        }
Ejemplo n.º 2
0
        public static int Solve(IEnumerable <string> passwords)
        {
            var lines = PasswordLine.LinesFrom(passwords);

            return(lines.Count(x =>
            {
                var characterCount = x.Password.Count(y => y == x.Character);
                return characterCount >= x.PolicyRuleInt1 && characterCount <= x.PolicyRuleInt2;
            }));
        }