add: 最长无重复字符的子串

This commit is contained in:
2020-05-02 16:06:08 +08:00
parent 4cb154f7c7
commit 801073e385
4 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import { lengthOfLongestSubstring } from '../../src/string/longest-substring-without-repeating-characters'
test('最长无重复字符的子串', () => {
expect(lengthOfLongestSubstring('abcabcbb')).toBe(3)
expect(lengthOfLongestSubstring('bbbbb')).toBe(1)
expect(lengthOfLongestSubstring('pwwkew')).toBe(3)
expect(lengthOfLongestSubstring('')).toBe(0)
expect(lengthOfLongestSubstring(' ')).toBe(1)
expect(lengthOfLongestSubstring('au')).toBe(2)
expect(lengthOfLongestSubstring('dvdf')).toBe(3)
})