ServiceNow Interview Question

Sliding window and knapsack problem