2275. Largest Combination With Bitwise AND Greater Than Zero

Обновлено: 2024-03-12
1 мин
[]

Содержание

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