You are given five arrays of the same length n that describe n records. Record i has a time timestamps[i], a label venues[i], a price fillPrices[i], a reference price benchmarkPrices[i], and a count volumes[i]. You are also given a string targetVenue and two integers maxSpread and maxCost.
Keep only the records whose label equals targetVenue, and put the kept records in increasing order of time. You can assume no two records that share a label also share a time.
The cost of a record is abs(fillPrices[i] - benchmarkPrices[i]) * volumes[i].
A window is a contiguous block of the kept records in that order. A window fits the budgets when both of these hold:
maxSpread;maxCost.Return the number of records in the longest window that fits the budgets. If no record has the label targetVenue, return 0. If no window fits the budgets, return 0.
timestamps.lengthvenues.length = fillPrices.length = benchmarkPrices.length = volumes.length =ntimestamps[i] ≤109venues[i] and targetVenue are 1 to 10 characters long, each a lowercase letter or a digitfillPrices[i], benchmarkPrices[i] ≤104volumes[i] ≤100maxSpread ≤104maxCost ≤109