Company: Ibm_5nov
Difficulty: medium
Maximum Consecutive Hidden Commits Problem Description A repository's commits are listed by their integer IDs in strictly increasing order, commits[0] < commits[1] < ... < commits[n-1] . A UI filter may hide one contiguous block of that list, commits[k] .. commits[p] . The block is reconstructible when the commits that remain visible pin the hidden IDs down exactly: inside the list ( k >= 1 and p <= n-2 ): the neighbours commits[k-1] and commits[p+1] are both visible, and the IDs strictly between them are exactly the hidden ones, so the block is reconstructible when p - k + 1 == commits[p+1] - commits[k-1] - 1 ; at the front ( k == 0 , p <= n-2 ): only commits[p+1] bounds the block, so it is reconstructible when p + 1 == commits[p+1] - commits[0] ; at the back ( k >= 1 , p == n-1 ): only commits[k-1] bounds it, so it is reconstructible when n - k == commits[n-1] - commits[k-1] . Hiding the entire list leaves nothing to deduce from and is never allowed. Hiding nothi