InterviewLegend

Bits & Number Theory

Alex Chen28 min readUpdated 81 real interview reports

The inputs in these problems are too big to enumerate anything, so the solution has to come from a property of the values. Every OR of ten-bit numbers fits in 1024 slots. A product is odd only when every factor is odd. In the remainder sum, n mod j breaks into blocks of j values that share a quotient. Look for that property before you write code. For each of these problems, the brute force passes the sample and fails the hidden tests.

Once you have it, the rest is careful arithmetic. When you subtract under a modulus, remember that C++ and Java keep the sign of a negative remainder. Check every product for 64-bit overflow. In the parity problem, check m = 0, where every power product is 1 and the answer is just the parity of the word count.

CitadelPremium lesson · Coding round

The 4 Citadel problems are below.

  1. A Premium questionCoding · Hard · Frequently asked
  2. A Premium questionCoding · Hard
  3. A Premium questionCoding · Hard

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Citadel questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your Citadel interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Citadel interview guide

Know what Citadel asks before you walk in.

30 coding · 5 system design · 15 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.