problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::longest_substring_with_at_most_k_distinct_characters::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int lengthOfLongestSubstringKDistinct (const string &s, int k)
 

详细描述

在文件 leetcode.h2812 行定义.

成员函数说明

◆ lengthOfLongestSubstringKDistinct()

int leetcode::longest_substring_with_at_most_k_distinct_characters::Solution::lengthOfLongestSubstringKDistinct ( const string &  s,
int  k 
)
static

在文件 leetcode.cpp7750 行定义.

7750 {
7751 if(k == 0) {
7752 return 0;
7753 }
7754 int l = 1;
7755 int r = s.length();
7756 while(l < r) {
7757 const int mid = (l + r) / 2 + 1;
7759 if(res > k) {
7760 r = mid - 1;
7761 } else {
7762 l = mid;
7763 }
7764 }
7765 return l;
7766 }

引用了 leetcode::longest_substring_with_at_most_two_distinct_characters::Solution::getMinUniqueCharCnt().

被这些函数引用 leetcode::longest_substring_with_at_most_k_distinct_characters::TEST().


该类的文档由以下文件生成: