Template Function ADS::longestKDistinctRun

Function Documentation

template<std::ranges::random_access_range R>
std::pair<std::size_t, std::size_t> ADS::longestKDistinctRun(const R &S, std::size_t k)

longestKDistinctRun(): the start and the length of the first longest run of consecutive items of S with at most k distinct values, by a sliding window; O( n log k )

Post:

the run has at most k distinct values (an audit)