FastPrepComplement the Significant Binary Digits
Problems/Complement the Significant Binary Digits

Complement the Significant Binary Digits

Intuit logoIntuit● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit new grad online assessment. The report says that, given an integer, you find its complement.

The report does not state the bit width or how zero is handled. Here, the input is positive and only its significant binary digits are flipped.

Our version is about 70% the same as the reported question.

Given a positive integer n, write it in binary without leading zeros. Flip each digit: change every 0 to 1 and every 1 to 0. Return the integer represented by the flipped digits.

For this exercise, assume that only the significant binary digits are flipped. Do not add leading digits or use a fixed-width signed complement.

Function

integerComplement(n: int) → int

Examples

Example 1

n = 5return = 2

The binary form of 5 is 101. Flipping its three digits gives 010, which represents 2.

Example 2

n = 8return = 7

The binary form 1000 becomes 0111, which represents 7.

Constraints

  • For this exercise, assume 1 <= n <= 2147483647.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Minimum Testers to Find the Poisoned BottleWalleye Capital · OA
  • Address on Same PageNVIDIA · OANVIDIA interview questions
  • Three-Speaker Truth ConsistencySusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Find the Missing Number from 1 to nGEP · OA
  • Invert Ad Visibility BitsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Are They PangramsVanguard · OAVanguard interview questions
  • Count Times Using at Most Two DigitsLSEG · OALSEG interview questions
  • Minimum Tokens RemainingMicrosoft · OAMicrosoft interview questions
  • Minimum Operations to Make Binary PalindromicGoogle · OAGoogle interview questions
  • Powers of 2Oracle · OAOracle interview questions

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public int integerComplement(int n) {
        // Write your code here
    }
}
Checking account…