Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

String

reference

are your strings immutable Atoi sample code

    def myAtoi(self, s):

        if len(s) == 0 : return 0
        ls = list(s.strip())
        
        sign = -1 if ls[0] == '-' else 1

        if ls[0] in ['-','+'] : del ls[0]

        ret, i = 0, 0

        while i < len(ls) and ls[i].isdigit() :
            ret = ret*10 + ord(ls[i]) - ord('0')
            i += 1

        return max(-2**31, min(sign * ret,2**31-1))
basic
# leetcode-cn leetcode solution
58 最后一个单词的长度 length-of-last-word python
709 转换成小写字母 to-lower-case
771 宝石与石头 jewels-and-stones
387 字符串中的第一个唯一字符 first-unique-character-in-a-string
8 字符串转换整数 (atoi) string-to-integer-atoi
operation
# leetcode-cn leetcode
14 最长公共前缀 longest-common-prefix
344 反转字符串 reverse-string
541 反转字符串 II reverse-string-ii
151 翻转字符串里的单词 reverse-words-in-a-string
557 反转字符串中的单词 III reverse-words-in-a-string-iii
917 仅仅反转字母 reverse-only-letters
anagram
# leetcode-cn leetcode
242 有效的字母异位词 valid-anagram
49 字母异位词分组 group-anagrams
438 找到字符串中所有字母异位词 find-all-anagrams-in-a-string
palindrome
# leetcode-cn leetcode
125 验证回文串 valid-palindrome
680 验证回文字符串 Ⅱ valid-palindrome-ii
5 最长回文子串 longest-palindromic-substring
subsequence + DP

正则表达式匹配 详解

# leetcode-cn leetcode
1143 最长公共子序列 longest-common-subsequence
72 编辑距离 edit-distance
10 正则表达式匹配 regular-expression-matching
44 通配符匹配 wildcard-matching
115 不同的子序列 distinct-subsequences
KMP

字符串匹配之KMP、BoyerMoore、Sunday算法

字符串匹配暴力法代码示例

Rabin-Karp 代码示例

字符串匹配的KMP算法

KMP字符串匹配算法1