Inaccurate Subsequence Search
MediumRating 1400CodeforcesMixed Practice
Approach hintTry it first, then revealHide
Slide a window of length m over a and maintain how many of its elements can be matched against the multiset b, using count maps for b and for the window, so each shift updates the match count in O(1).