RBC Interview Question

A python coding question with sliding window pattern