Company: Edelwiess_14nov
Difficulty: medium
Compromised Subarray Count Problem Description A cyber security expert has just intercepted a transmission from a group of cybercriminals. The transmission contains an array of binary codes, which represents some confidential information. However, after a thorough analysis, the expert discovered a vulnerability in the encryption method. An array is considered to be compromised if the bitwise OR of all elements in the subarray is present in the array itself. The goal is to find the number of compromised subarrays in the intercepted transmission and prevent the cybercriminals from exploiting this weakness in their encryption. Note: A subarray is defined as any contiguous segment of the array. Examples Example 1: Input: n = 3, arr = [1, 6, 7] Output: 5 Explanation: Subarray | Bitwise OR | Is compromised? [1] | 1 | Yes [6] | 6 | Yes [7] | 7 | Yes [1, 6] | 7 | Yes [6, 7] | 7 | Yes [1, 6, 7] | 7 | Yes Hence the answer is 5. Example 2: Input: n = 3, arr = [2, 4, 7] Output: 4 Explanation: Suba