IBM interview question

Slinding window based coding Hacker Rank question