2275. Largest Combination With Bitwise AND Greater Than Zero

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2275

class Solution:
    def largestCombination(self, candidates: List[int]) -> int:
        res = 0
        for i in range(32):
            t = 0
            for x in candidates:
                t += (x >> i) & 1
            res = max(res, t)
        return res