← Citi Interview Insights

Citi·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Citi software engineer interview that was basically two classic brain teasers back to back. The kind of session where you know the puzzles exist somewhere in the universe but blanking under pressure is very real.

Questions Asked (2)

Q1

You have 12 identical-looking balls where exactly one is heavier. Using a balance scale exactly three times, identify the heavier ball and explain why three weighings are both sufficient and necessary.

Algorithms & Data Structures
Author's notes

I knew this puzzle existed but could not reconstruct the full solution cleanly under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the information-theoretic lower bound: each weighing has three outcomes, so three weighings can distinguish at most 3^3 = 27 cases, which is more than the 12 possibilities, proving sufficiency. Then describe a concrete strategy: first weigh 4 vs 4, then narrow down to 4 suspects, and finally weigh 1 vs 1 to identify the heavy ball. For necessity, argue that two weighings yield at most 9 outcomes, which is insufficient for 12 balls.

Pro tip: Emphasize the decision-tree perspective: each weighing should split the remaining possibilities into three groups as evenly as possible. This shows you understand the underlying principle, not just the specific solution.

1. Understand the problem and constraints

Restate the problem: 12 balls, one heavier, balance scale, exactly three weighings. Clarify that the scale compares two pans and gives three outcomes: left heavy, right heavy, or balanced.

2. Prove sufficiency with a concrete strategy

Describe the first weighing: 4 vs 4. If balanced, the heavy ball is among the remaining 4; if not, it's among the heavier group of 4. Then for the second weighing, take 3 from the suspect group and weigh against 3 known good balls (or use a 2 vs 2 split if needed). Finally, for the third weighing, weigh 1 vs 1 to identify the heavy ball.

3. Prove necessity using information theory

Explain that each weighing has 3 possible outcomes, so two weighings can distinguish at most 3^2 = 9 cases. Since there are 12 possible heavy balls, two weighings are insufficient. Three weighings give 3^3 = 27 outcomes, which is enough.

4. Discuss optimality and generalization

Mention that the strategy is optimal because it matches the information-theoretic lower bound. Also note that the same principle applies to finding a heavier ball among up to 3^k balls in k weighings.

Key Points to Mention

  • Information theory: each weighing has 3 outcomes, so k weighings can distinguish at most 3^k cases.
  • For 12 balls, 3^2 = 9 < 12, so at least 3 weighings are necessary.
  • 3^3 = 27 ≥ 12, so 3 weighings are sufficient.
  • Concrete strategy: first weigh 4 vs 4, then narrow down to 4 suspects, then weigh 1 vs 1.
  • Decision tree: each weighing should partition the remaining possibilities into three groups as evenly as possible.
  • Generalization: with k weighings, you can find one heavier ball among up to 3^k balls.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Four people need to cross a bridge at night with one torch. Their individual crossing times are 1, 2, 7, and 10 minutes. Only two can cross at once and the torch must travel with them. What is the minimum time to get everyone across, what sequence achieves it, and how do you prove it's optimal?

Algorithms & Data Structures
Author's notes

The answer is 17 minutes and the key insight is pairing the two slowest together so you're not making two slow solo trips.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and then solve it by exploring possible strategies, focusing on minimizing the total time. Use a systematic approach to find the optimal sequence, then prove optimality by considering lower bounds and eliminating alternatives.

Pro tip: Demonstrate structured problem-solving by first explaining the general principle (e.g., using the two fastest to shuttle the torch) and then applying it to the specific numbers. This shows you can generalize and not just memorize the answer.

1. Understand the problem

Restate the problem in your own words, ensuring you understand the constraints: four people, one torch, at most two cross at a time, and the torch must be carried. Identify the goal: minimize total time.

2. Identify possible strategies

Consider common strategies: sending the two fastest together repeatedly, or sending the two slowest together with the fastest shuttling back. Recognize that the optimal strategy often involves a trade-off between these.

3. Find the optimal sequence

Try sequences and calculate times. The known optimal sequence for times 1,2,7,10 is: 1 and 2 cross (2), 1 returns (1), 7 and 10 cross (10), 2 returns (2), 1 and 2 cross (2). Total = 17 minutes.

4. Prove optimality

Show that any solution must have at least 5 crossings (since 4 people need to cross and each crossing moves at most 2, but returns are needed). Then argue that the two slowest (7 and 10) must cross together to avoid their times being counted separately, and the two fastest (1 and 2) must be used to shuttle the torch. Compute lower bounds: the sum of the two slowest times (17) is a lower bound because they must cross at least once, and the total time cannot be less than the sum of the two slowest plus the necessary shuttling. Alternatively, use a state-space search or dynamic programming to confirm 17 is minimal.

5. Communicate clearly

Present the sequence step-by-step with times, state the total, and explain why it's optimal. Be prepared to discuss alternative strategies and why they are suboptimal.

Key Points to Mention

  • The optimal strategy often involves sending the two slowest together to minimize their impact.
  • The two fastest are used as shuttlers to return the torch efficiently.
  • The total time is the sum of crossing times for each trip.
  • Proof of optimality can be done by lower bound arguments or exhaustive search.
  • The sequence: 1&2 cross (2), 1 returns (1), 7&10 cross (10), 2 returns (2), 1&2 cross (2) = 17 minutes.
  • Generalization: For times a<b<c<d, the optimal time is min(2b + a + c + d, 2a + b + c + d) but for 1,2,7,10 it's 17.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.