コード例 #1
0
  @Test
  public void testMaxSubStringKUniqueChars() throws Exception {
    String input = "abcbbbbcccbdddadacb";
    String expectedOutput = "bcbbbbcccb";

    LongestSubstring longestSubstring = new LongestSubstring();
    String result = longestSubstring.maxSubStringKUniqueChars(input, 2);

    assertEquals(result, expectedOutput);
  }
コード例 #2
0
  @Test
  public void testMaxSubStringKUniqueChars4() throws Exception {
    String input = "aaaaaaaaaaaaaaaa";
    String expectedOutput = null;

    LongestSubstring longestSubstring = new LongestSubstring();
    String result = longestSubstring.maxSubStringKUniqueChars(input, 2);

    assertEquals(result, expectedOutput);
  }