#3670
Maximum Product of Two Integers With No Common Bits
medium · 15.1% accepted · 99 likes · top 0%
array · dynamic programming · bit manipulation
Description
You are given an integer array nums.
Your task is to find two distinct indices i and j such that the product nums[i] * nums[j] is maximized, and the binary representations of nums[i] and nums[j] do not share any common set bits.
Return the maximum possible product of such a pair. If no such pair exists, return 0.
Solution