Exemple #1
0
        public static int GetNumberOfYesAnswers(List <string> input)
        {
            List <string> uniqueAnswers         = Customs.GetUnionAllAnswers(input);
            List <int>    uniqueDistinctAnswers = new List <int>();

            uniqueAnswers.ForEach(uniqueAnswer => uniqueDistinctAnswers.Add(uniqueAnswer.Distinct().Count()));

            return(uniqueDistinctAnswers.Sum());
        }
        public static int GetNumberOfYesAnswersEveryone(List <string> input)
        {
            List <string> uniqueAnswers = Customs.GetUnionAllAnswers(input);

            int everyoneAnswers = uniqueAnswers
                                  .Select(answer => answer.Split('\n')
                                          .Aggregate((a, b) => string.Concat(b.Intersect(a)))
                                          .Count())
                                  .Sum();

            return(everyoneAnswers);
        }