Longest Palindromic Substring,最长回文子字符串 Count of Palindromic Substrings,最长子字符串的个数问题 Minimum Deletions in a String to make it a Palindrome,怎么删掉最少字符构成回文 Palindromic Partitioning,怎么分配字符,形成回文 5. Longest Common Substring,最长子字符串系列,13个题 Longest Common Substrin...
https://leetcode.cn/problems/palindrome-pairs 由于题目非常古老case不全面,很多题解都是复杂度严重不合理的,但运行速度不慢。这道题的正解是双字典树,但不是把一个单词的前缀和后缀简单地分别在2棵树里匹配一下,而是用前缀字典树来匹配后缀字典树,即前缀字典树和后缀字典树需要同步移动,这才能DFS一遍就能找到...
maximum-number-of-non-overlapping-palindrome-substrings maximum-number-of-pairs-in-array maximum-number-of-points-from-grid-queries maximum-number-of-vowels-in-a-substring-of-given-length maximum-number-of-weeks-for-which-you-can-work maximum-number-of-words-found-in-sentences maximum-pr...
传统上,我们可以把数据结构分成逻辑结构和物理结构两大类。逻辑结构分类:逻辑结构市场ongoing具体问题中抽...
判断string中的小括号是否匹配,'*'可以代表任意一个或空。 problem View Code View Code 680. Valid Palindrome II (easy) 允许删除最多一个字母,判断string是否是回文 problem View Code 696. Count Binary Substrings (easy) 0和1的个数相同的子串个数,(0或1必须连续) problem View Code p...
2422.Merge-Operations-to-Turn-Array-Into-a-Palindrome (H-) Sliding window 532.K-diff-Pairs-in-an-Array (H-) 611.Valid-Triangle-Number (M+) 930.Binary-Subarrays-With-Sum (M+) 1004.Max-Consecutive-Ones-III (M) 1052.Grumpy-Bookstore-Owner (M) 1358.Number-of-Substrings-Containing-All...
classSolution {public:intlongestPalindromeSubseq(strings) {intn =s.size(); vector<vector<int>> memo(n, vector<int>(n, -1));returnhelper(s,0, n -1, memo); }inthelper(string& s,inti,intj, vector<vector<int>>&memo) {if(memo[i][j] != -1)returnmemo[i][j];if(i > j)return...
leetcode My leetcode solutions for Javascript / Swift / Mysql Typical Problems Dynamic Programming Tree String Math Heap Min-Heap 1642. Furthest Building You Can Reach Quick Remove 218. The Skyline Problem Rule Common 89. Gray Code Common ...
8.字符串转换整数(atoi) (String to Integer (atoi))9.回文数(Palindrome Number)10.正则表达式匹配(Regular Expression Matching)11.盛最多水的容器(Container With Most Water)12.整数转罗马数字(Integer to Roman)13.罗马数字转整数(Roman to Integer)14.最长公共前缀(Longest Common Prefix)15.三数之和(3Sum...
1177 Can Make Palindrome from Substring 34.6% Medium 1178 Number of Valid Words for Each Puzzle 37.9% Hard 1179 Reformat Department Table 80.5% Easy 1180 Count Substrings with Only One Distinct Letter 77.0% Easy 1181 Before and After Puzzle 44.4% Medium 1182 Shortest Distance to Target ...