public void ShouldReturnLongestSequenceInList()
        {
            var longestSequence = new Longest();

            var dummySeed = new List<int>() { 1, 2, 3, 4, 5, 6, 6, 6, 6, 7, 7, 7, 8, 9, 10, 1, 1, 2, 4, 2 };

            var result = longestSequence.GetLongestSubsequenceOfEqualNumbersInList(dummySeed);

            var expected = new List<int>() { 6, 6, 6, 6 };

            var resultAsString = string.Join("", result);

            var expectedAsString = string.Join("", expected);

            Assert.AreEqual(resultAsString, expectedAsString);
        }
        static void Main(string[] args)
        {
            string dummyValues = "1, 2, 3, 4, 5, 6, 6, 6, 6, 7, 7, 7, 8, 9, 10, 1, 1, 2, 4, 2";

            // var readLine = Console.ReadLine();
            var readLine = dummyValues;
            if (readLine != null)
            {
                var list = readLine
                    .Trim()
                    .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToList();

                var longest = new Longest();

                var result = longest.GetLongestSubsequenceOfEqualNumbersInList(list);

                Console.WriteLine(string.Join(",", result));
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            string dummyValues = "1, 2, 3, 4, 5, 6, 6, 6, 6, 7, 7, 7, 8, 9, 10, 1, 1, 2, 4, 2";

            // var readLine = Console.ReadLine();
            var readLine = dummyValues;

            if (readLine != null)
            {
                var list = readLine
                           .Trim()
                           .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                           .Select(int.Parse)
                           .ToList();

                var longest = new Longest();

                var result = longest.GetLongestSubsequenceOfEqualNumbersInList(list);

                Console.WriteLine(string.Join(",", result));
            }
        }