Minimum Sum of Values by Dividing Array
Split the array into pieces whose ANDs match the target values, paying each piece its last element, and keep the cheapest split.
Split the array into pieces whose ANDs match the target values, paying each piece its last element, and keep the cheapest split.