public void Test()
        {
            var solution = new LongestCommonPrefixSolution();

            Assert.AreEqual("fl", solution.LongestCommonPrefix(new[] { "flower", "flow", "flight" }));
            Assert.AreEqual("", solution.LongestCommonPrefix(new[] { "dog", "racecar", "car" }));
        }
Ejemplo n.º 2
0
        public void Common_Test()
        {
            // Arrange
            var solution = new LongestCommonPrefixSolution();

            //act
            var result = solution.LongestCommonPrefix(new string[] { "aa", "a" });

            //Assert
            Assert.Equal("a", result);
        }
Ejemplo n.º 3
0
        public void Empty_First_Massive_Item_Result_Should_Be_Empty_String()
        {
            // Arrange
            var solution = new LongestCommonPrefixSolution();

            //act
            var result = solution.LongestCommonPrefix(new string[] { "" });

            //Assert
            Assert.Equal(string.Empty, result);
        }
Ejemplo n.º 4
0
        public void LongestCommonPrefixTest(string[] strs, string expected)
        {
            var actual = new LongestCommonPrefixSolution().LongestCommonPrefix(strs);

            Assert.Equal(expected, actual);
        }