Salesforce Data Compression

Company: Salesforce Amts_27june

Difficulty: medium

Problem Statement

Salesforce Data Compression Salesforce is compressing a dataset stored in an array data of n integers, where each element is the size of one data chunk. The goal is to make the largest chunk as small as possible. You may apply the following operation any number of times (including zero times): 1. Choose a range [l, r] with 0 <= l < r <= n - 1 . 2. Choose an index i with 0 <= i <= r - l . 3. Replace data[l + i] with data[l + i] & data[r - i] , where & is the bitwise AND. Report the smallest possible value of the maximum element of data after an optimal sequence of operations. Complete the function getOptimizedData . It receives the array data and must return the minimized maximum value. Input Format The first line contains a single integer n - the number of elements in data . Each of the next n lines contains a single integer data[i] . Output Format Print a single integer - the minimum possible value of the largest element of data . Constraints 1 <= n <= 150