
字符串
hmyqwe
这个作者很懒,什么都没留下…
展开
-
leetcode-1371-每个元音包含偶数次的最长子字符串
时间复杂度 O(N) 额外空间复杂度 O(1) class Solution { public int findTheLongestSubstring(String s) { // 记录结果,即下标差 int res = 0; // 记录截止遍历位,元音字符串 "aeiou" 每一种 bit mask 出现的最小下标 数组大小为 2^5 int seen[] = new int[32]; // 初始位置 bit ma..原创 2021-10-11 22:59:44 · 299 阅读 · 0 评论 -
leetcode-1542-找出最长的超赞子字符串
class Solution { public int longestAwesome(String s) { // 记录结果,即下标差 int res = 0; // 记录截止遍历位每一种 bit mask 出现的最小下标 数组大小为 2^10 int seen[] = new int[1024]; // 初始位置 bit mask 为 0,即空串 int mask = 0; int ..原创 2021-10-11 15:08:08 · 198 阅读 · 0 评论 -
leetcode-1915-最美子字符串的数目
class Solution { public long wonderfulSubstrings(String word) { // 记录结果 long res = 0; // 记录截止遍历位每一种 bit mask 出现的次数 数组大小为 2^10 long count[] = new long[1024]; // 初始位置 bit mask 为 0,即空串 int mask = 0; ..原创 2021-10-10 13:26:13 · 196 阅读 · 0 评论