[LeetCode] Minimize OR of Remaining Elements Using Operations

1 · · Jan. 28, 2024, 4:28 a.m.
3022. Minimize OR of Remaining Elements Using Operations You are given a 0-indexed integer array nums and an integer k. In one operation, you can pick any index i of nums such that 0 <= i < nums.length - 1 and replace nums[i] and nums[i + 1] with a single occurrence of nums[i] & nums[i + 1], where & represents the bitwise AND operator. Return the minimum possible value of the bitwise OR of the remaining elements of nums after applying at most k operations. ...