Available question text
You're allowed to repeatedly pair elements and replace them with their bitwise AND and OR, which effectively transfers set bits between numbers; maximize the sum of squares of any k elements after any sequence of such operations. The core challenge is to optimally redistribute bit counts across the array (using per-bit frequencies) to build k large numbers that maximize the sum of squares under constraints n ≤ 1e5 and nums[i] ≤ 1e9.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2897. Apply Operations on Array to Maximize Sum of Squares
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source