Ericsson interview question

A coding question about sliding window,