Company: Salesforce AMTS on-campus_16april
Difficulty: medium
A data platform team is running an advanced compression pass over a dataset stored in an array named data , where each element represents the size of a data chunk. The goal is to shrink the largest chunk size in the array as much as possible by applying the following operation any number of times, in any order: Select a range [ l , r ], where 0 ≤ l < r < size of data[] . Select an index i in the range [0, r - l ]. Update data[l + i] = data[l + i] & data[r - i] . Report the smallest possible value of the array's maximum element once these operations have been applied as effectively as possible. Because the bitwise AND used here never increases a value and behaves consistently no matter how it's repeated, simply comparing pairs one at a time won't scale under these rules — an O(n) approach is needed instead. Example n = 2 data[] = [1, 2] Choose range [0, 1]. First with i = 0, set data[0] = 1 & 2 = 0. Then with i = 1, set data[1] = 2 & 0 = 0. The array is now [0, 0],