Remove characters from the beginning of sliding window having count more than 1 to minimize length .
if ( distEle == k ) { while ( st < end && cnt [ str [ st ] - ' a ' ] > 1 ) { cnt [ str [ st ] - ' a ' ] -- ; st ++ ; }