public void LengthOfLongestSubstringTest3() { LongestSubstring longestSubstring = new LongestSubstring(); int res = longestSubstring.LengthOfLongestSubstring("pwwkew"); Assert.IsTrue(res == 3); }
public void LengthOfLongestSubstringTest4() { LongestSubstring longestSubstring = new LongestSubstring(); int res = longestSubstring.LengthOfLongestSubstring(""); Assert.IsTrue(res == 0); }
public void LengthOfLongestSubstringTest1() { LongestSubstring longestSubstring = new LongestSubstring(); int res = longestSubstring.LengthOfLongestSubstring("abcabcbb"); Assert.IsTrue(res == 3); }
static void Main(string[] args) { Console.WriteLine(LongestSubstring.findLongestSubStringK(3, "cbbebi")); Console.WriteLine(LongestSubstring.MaxFruitCountOf2Types(new char[] { 'A', 'B', 'C', 'B', 'B', 'C' })); Console.ReadLine(); }
private void MyEntryCompleted(object sender, EventArgs e) { InputLabel.Text = myEntry.Text; string myString = myEntry.Text; OutputLabel.Text = LongestSubstring.FindSubSting(ref myString); myEntry.Text = null; }
public void LongestSubstring() { LongestSubstring ls = new LongestSubstring(); Assert.Equal("CDGH", ls.Find("ABCDGH", "ACDGHR")); Assert.Equal("CDGH", ls.Find("ABCDGH", "ABRCDGH")); Assert.Equal("A", ls.Find("ABC", "AC")); Assert.Equal("", ls.Find("A", "B")); }
/// <summary> /// 알고리즘 테스트용 콘솔 /// </summary> /// <param name="args"></param> static void Main(string[] args) { for (; ;) { string myString = Console.ReadLine(); Console.WriteLine(LongestSubstring.FindSubSting(ref myString)); Console.Write('\n'); Console.ReadKey(); } }
public void LengthOfLongestSubstring_ShouldReturn_LengthOfLongestNonRepeatedSubstring( string s, int expectedMaximumLength) { // Arrange var longestSubstring = new LongestSubstring(); // Act var maximumLength = longestSubstring.LengthOfLongestSubstring(s); // Assert maximumLength.Should().Be(expectedMaximumLength); }
public void LongestSubstringSlidingWindowSuccess() { string input = "abcabcbb"; int result; result = new LongestSubstring().LengthOfLongestSubstringSlidingWindow(input); Assert.AreEqual(result, 3); input = "pwwkew"; result = new LongestSubstring().LengthOfLongestSubstringSlidingWindow(input); Assert.AreEqual(result, 3); input = "bbbbbb"; result = new LongestSubstring().LengthOfLongestSubstringSlidingWindow(input); Assert.AreEqual(result, 1); }
void InternalTest(string s, int expected) { int count = LongestSubstring.LengthOfLongestSubstring(s); Assert.Equal <int>(expected, count); }
private static void ExistingCases() { Console.WriteLine("This is DB practice session.."); Console.WriteLine("Press 1 for Binary search tree"); Console.WriteLine("Press 2 for two sum problem"); Console.WriteLine("Press 3 for Maximum Area Cake problem"); Console.WriteLine("Press 4 for Find Inflection point."); Console.WriteLine("Press 5 for Max heap."); Console.WriteLine("Press 6 for Longest substring."); Console.WriteLine("Press 7 for Reverse linked list."); Console.WriteLine("Press 8 for Reverse linked list."); int option = 5; switch (option) { case 1: BinarySearchOperations(); break; case 2: RandomProblems.TwoSumProblem(); break; case 3: MaximumAreaCake.MaximumAreaCakeCaller(); break; case 4: CodeFindInflectionPoint.FindInflectionPoint(); break; case 5: MaxHeap.Test(); break; case 6: LongestSubstring.Test(); break; case 7: ReverseListSolution.Test(); break; case 8: SlidingWindows.Test(); break; case 9: SlowAndFastPointers.Tests(); break; case 10: CyclicSort.Tests(); break; case 11: FastAndSlowPointers.Tests(); break; case 12: MergeIntervals.Tests(); break; default: break; } }
public LongestSubstringTests() { _testsVerifier = new TestsVerifier(); _objUnderTest = new LongestSubstring(); }
public void LengthOfLongestSubstringTest(string s, int expected) { var sut = new LongestSubstring(); Assert.Equal(expected, sut.LengthOfLongestSubstring(s)); }
public void Setup() { _sut = new LongestSubstring(); }