Available question text
Given a positive integer, return the integer formed by flipping every bit in its binary representation up to its most significant 1 (i.e., invert all bits excluding leading zeros). This is a bit-manipulation problem—build a mask of 1s covering num's bit-length and xor/negate num against that mask (1 <= num < 2^31).
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 476. Number Complement
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source