#include <leetcode.h>
◆ dfs()
pair< int, int > leetcode::longest_nice_substring::Solution::dfs |
( |
string |
s, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 2108 行定义.
2116 for(
int i = start; i <= end; i++) {
2117 const char ch = s[i];
2118 if(islower(ch) != 0) {
2119 lower |= 1 << ch -
'a';
2122 upper |= 1 << ch -
'A';
2125 if(lower == upper) {
2127 return {start, end - start + 1};
2130 const int not_nice = lower ^ upper;
2133 if((not_nice >> tolower(s[i]) -
'a' & 1) == 1) {
2139 while(j <= end && (not_nice >> tolower(s[j]) -
'a' & 1) != 1) {
2142 auto [next_start, next_len] =
dfs(s, i, j - 1);
2143 if(max_len < next_len) {
2145 max_start = next_start;
2149 return {max_start, max_len};
static pair< int, int > dfs(string s, int start, int end)
引用了 dfs().
被这些函数引用 dfs() , 以及 longestNiceSubstring().
◆ longestNiceSubstring()
string leetcode::longest_nice_substring::Solution::longestNiceSubstring |
( |
const string & |
s | ) |
|
|
static |
该类的文档由以下文件生成: