Maximum Security Clearance

Company: rubrik_4oct

Difficulty: medium

Problem Statement

Maximum Security Clearance Problem Description You are a cybersecurity engineer working on a distributed encryption system. Data is stored in n chunks placed in a row, and every chunk has a security level written as an m -bit integer. A high-privilege operation needs Maximum Security Clearance : it must use a group of consecutive data chunks whose combined security level, the bitwise OR of their levels, equals 2^m - 1 (the m -bit number with every bit set to 1). For each test case, find the length of the shortest run of consecutive chunks whose bitwise OR equals 2^m - 1 . If no run of consecutive chunks reaches 2^m - 1 , report -1 . Function Description Complete the function findShortestSequence in the editor. It has the following parameters: int n : the number of data chunks int m : the number of bits in a security level int a[n] : the security levels of the chunks, in order It returns an int : the length of the shortest contiguous run of chunks whose bitwise OR equals 2^m - 1 , or -1