BOX Partners, LLC interview question

sliding window based coding question with less time complexity