Exemple #1
0
        // slightly neater.
        public List<Tuple<int, char>> Attempt2(List<char> l)
        {
            var p9Instance = new P9();
            var groupedList = p9Instance.Compress(l);
            var rleList = (from ll in groupedList select new Tuple<int, char>( ll.Count, ll[0])).ToList();

            return rleList;
        }
Exemple #2
0
        // very obvious approach
        public List<Tuple<int, char>> Attempt1(List<char> l)
        {
            var p9Instance = new P9();
            var groupedList = p9Instance.Compress(l);
            var rleList = new List<Tuple<int, char>>();

            foreach (var group in groupedList)
            {
                rleList.Add(new Tuple<int, char>(group.Count, group[0]));
            }

            return rleList;
        }