Hello,
I found that in problem 13.8 (Find smallest subarray covering all values), the following code may be unnecessary. This is because the result will finally be set later when advancing the left index.
// Found all keywords, update the smallest subarray containing all keywords.
if (keywords_to_count.size() == keywords.size() &&
((result.first == -1 && result.second == -1) ||
right - 1 - left < result.second - result.first)) {
result = {left, right - 1};
}
Moreover, I think the condition “left < right” may be also redundant when advancing the left because the keywords_to_count map will finally reduce to less than the keywords.size():
while (**left < right &&** keywords_to_count.size() == keywords.size())
I removed the above codes and tested with the EPI testing engine and have found no assertion error.