← Back to blog Citadel SDE Intern OA Breakdown: Price Check + Framing Text + Friend Recommendation
Citadel

Citadel SDE Intern OA Breakdown: Price Check + Framing Text + Friend Recommendation

2026-06-04

In the fiercely competitive quant-finance field, Citadel, as an industry pioneer, has long attracted top students. For those aiming at a Software Development Engineer (SDE) internship, the Citadel SDE Intern OA is a key threshold on the path to a dream internship. This article fully unpacks the three most common problems in this OA: statement, approach, complexity, and the boundaries that trip people up.

1. Citadel Intern OA Overview

Dimension Details
Platform HackerRank
Count Usually 3 coding problems
Style Simulation + string + graph, detail- and robustness-heavy
Difficulty Individually moderate, but condition-rich and easy to lose points to misreading

The core of the Citadel OA is not "do you know the optimal solution," but "is your code stable and are the boundaries handled cleanly."

2. Problem 1: Price Check

A shop uses old cash registers and prices are typed in manually, occasionally with errors. Given items and their correct prices, plus the actual sold items and the recorded prices, count the number of sale prices entered incorrectly.

def priceCheck(products, productPrices, productSold, soldPrice):
    # Build a name -> correct price map
    correct = dict(zip(products, productPrices))
    errors = 0
    for name, paid in zip(productSold, soldPrice):
        # Compare floats with tolerance to avoid 2.89 != 2.8900001 precision traps
        if abs(correct[name] - paid) > 1e-9:
            errors += 1
    return errors

Complexity: time O(n + m), space O(n). Boundary trap: prices are floats—never compare with ==, leave a 1e-9 tolerance; even though sold items are in the table, use a dict rather than linear lookup to avoid O(n*m).

3. Problem 2: Framing Text

Given a string of multiple words, print each word on its own line, wrapped in a rectangular frame, with one space between the word and the frame on each side.

For "Hello World in a frame":

+-------+
| Hello |
| World |
| in    |
| a     |
| frame |
+-------+
def print_boxed_text(input_str):
    words = input_str.split()
    width = max(len(w) for w in words)          # longest word sets the frame width
    border = '+' + '-' * (width + 2) + '+'
    lines = [border]
    for w in words:
        # left-align padded to a uniform width, one space each side
        lines.append('| ' + w.ljust(width) + ' |')
    lines.append(border)
    return '\n'.join(lines)

Complexity: time O(total chars), space O(same). Boundary trap: the frame width is set by the longest word; shorter words must be ljust-padded; the top/bottom border has width + 2 dashes (including the two side spaces)—miscount one and it misaligns.

4. Problem 3: Recommendation System (Friend Recommendation)

A friend-recommendation prototype for a social app: n users (0..n-1), m friendships. Recommend user x to user y if they are not friends and share the maximum number of mutual friends. Break ties by lowest index; output -1 if there is no candidate.

from collections import defaultdict

def recommend(n, friendships):
    adj = defaultdict(set)
    for a, b in friendships:
        adj[a].add(b)
        adj[b].add(a)

    result = []
    for y in range(n):
        best_user, best_mutual = -1, 0
        for x in range(n):
            if x == y or x in adj[y]:
                continue                     # skip self and existing friends
            mutual = len(adj[x] & adj[y])    # mutual count = adjacency set intersection
            # more mutuals -> update; on a tie, ascending x keeps the smallest index
            if mutual > best_mutual:
                best_mutual = mutual
                best_user = x
        result.append(best_user if best_mutual > 0 else -1)
    return result

Complexity: naive O(n^2 * d) (d = average degree). Boundary trap: ties take the smallest index—iterating x ascending with a strict > update satisfies this automatically; when the mutual count is 0, output -1—do not recommend an unrelated user.

5. Prep Cadence

Focus Tip
Simulation problems List every condition, then verify against it after coding
String formatting Watch alignment and frame width; run several local cases
Graph problems Adjacency set/intersection is frequent; practice mutual friends, connected components
Time control Do not die on one problem—AC first, optimize later

FAQ

Q1: Is the Citadel Intern OA hard?

Individually moderate, but detail-rich with low tolerance. Most people who fail are not stumped by the algorithm—they miss a boundary condition or use == for float comparison. Stable beats fast.

Q2: Why can't I compare float prices with ==?

Input and storage can carry tiny precision errors; 2.89 may not be exactly equal in float. Use abs(a-b) > 1e-9—this is the most common Price Check pitfall.

Q3: Does the recommendation problem need an optimal solution?

Not necessarily. For small n, O(n^2) set intersection passes. The key is not botching the two rules: smallest index on ties, output -1 when there is no candidate.

Q4: What if I run out of time on the OA?

Order the three problems by familiarity, lock in the ones you are sure of, and leave the detail-heavy one for last. We offer OA assistance / OA support: question-type prediction + timed practice + real-time direction so you capture what you know.


Preparing for the Citadel SDE Intern OA?

This OA tests detail and robustness, not exotic puzzles. If you want timed practice on the three problems, question-type prediction for quant-finance OAs, or real-time OA assistance / OA support, reach out—send the role's JD and we will break down the question types first, then plan a practice schedule.

Add WeChat Coding0201 now to get Citadel OA questions and practice.

Contact