Trains the technique from
LeetCode 2680Maximum ORThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A test bench drives a wall panel from a bank of signal generators. Generator i is described by the positive integer codes[i], and the panel lights a channel whenever at least one generator carries that channel, so the panel's reading is the bitwise OR of all the generator codes.
The bench also has a tray of identical doubler modules. Fitting a doubler onto a generator replaces that generator's code with twice its current value; fitting a second doubler onto the same generator doubles it again. You may fit at most boosts doublers in total, spread across the generators however you like, including several on one generator or none at all.
Return the largest panel reading you can obtain.
Example 1
Fitting the doubler to the generator coded 9 turns it into 18, and 18 OR 12 is 30.
Example 2
The lone generator absorbs all three doublers, taking 7 to 14, then 28, then 56.
Example 3
Doubling the generator coded 8 gives 16, and 16 OR 4 OR 2 OR 1 is 23.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def best_panel_reading(codes: list[int], boosts: int) -> int:public long bestPanelReading(int[] codes, int boosts)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.