Salesforce Interview Question

Variable window sliding window based problem