Algorithm · Salesforce · Easy
Requirements Input: an array timestamp containing n entries ($$1 \le n \le 2\cdot 10^{5}$$), where every timestamp[i] lies between 1 and $$10^{9}$$, plus an integer window width W ($$1 \le W \le 10^{9}$$). Output: determine the largest number of timestamp[i] entries that can fit in an inclusive interval [s, s + W - 1], with s an integer. A best interval can always be chosen with its starting point equal to some timestamp in the array: moving any other candidate start…
Checking your access…