Example #1
0
        public int GetAnswer()
        {
            var data   = DataGetter.GetData();
            var result = 0;

            foreach (var group in data.AllGroupAnswers)
            {
                var allYesForGroup = new List <char>();

                foreach (var personsAnswers in group)
                {
                    foreach (var answer in personsAnswers)
                    {
                        if (group.SelectMany(a => a.ToList()).Count(b => b == answer) >= group.Count &&
                            !allYesForGroup.Contains(answer))
                        {
                            allYesForGroup.Add(answer);
                        }
                    }
                }

                result += allYesForGroup.Count();
            }

            return(result);
        }
Example #2
0
        public int GetAnswer()
        {
            var data = DataGetter.GetData();

            return(data.AllGroupAnswers.Sum(a => a.SelectMany(a => a.ToList()).Distinct().Count()));
        }