Company: HackerRank
Difficulty: easy
An array timestamp of size n contains unique positive integers, possibly unordered. Your task is to find the first missing contiguous sequence of positive integers that has length at least windowSize . Return the starting number of the earliest such missing sequence. Note The sequence must consist of consecutive integers that do not appear in the array. Only sequences of length ≥ windowSize are valid. Among all valid sequences, return the one with the smallest starting value. Input Format The first line contains the integer n . Each of the next n lines contains one integer, an element of timestamp . The last line contains the integer windowSize . Output Format Print a single integer: the starting number of the earliest missing contiguous sequence of length at least windowSize . Constraints 1 ≤ n, windowSize ≤ 2 × 10 5 1 ≤ timestamp[i] ≤ 10 9 It is guaranteed that the array timestamp contains unique integers. Example 1 Input 4 4 2 1 7 2 Output 5 Explanation: timesta