← Questions

Maximize the bitwise AND of k elements with an increment budget

0
AmazonCodingLast asked Sep 2026

You get an array of non-negative integers, an integer k and a budget c. You may add amounts to elements as long as the total added over all elements is at most c. Then choose k elements. Return the largest possible bitwise AND of the chosen elements.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding