Company: opentext_13oct
Difficulty: medium
Vault Lock Sequence Problem Description A security company has made a lock for one of its vaults. The lock is highly secured and will open after following a particular sequence. On the door, there is a screen on which N numbers are displayed along with a key value, K. The correct sequence to open the door can be extracted from N numbers by replacing each number with the sum of the next K numbers. If the value of K is negative, then the number is replaced by the sum of the previous K numbers. The series of numbers is considered in a cyclic manner for the last key numbers. Write an algorithm for the company to find the correct sequence to open the lock of the vault. Input: The first line of the input consists of two space-separated integers - size and key , representing the total numbers displayed on the screen (N) and the key value (K), respectively. The second line consists of N space-separated integers - number₁, number₂, ....., numberN representing N numbers which are getting display