← Disney Interview Insights

Disney·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Disney SWE interview with a meaty ad-targeting problem that mixed algorithm thinking with system design. The question had enough moving parts that it was easy to go down the wrong path early.

Questions Asked (1)

Q1

Given a list of ads, each with attributes like target locations and age range, and a targeting rule with optional fields plus an AND/OR operator, return the IDs of ads that match the rule. How do you handle missing rule fields, and how does AND vs OR change how you compose the per-field checks? Also discuss data structures for fast repeated lookups against a static ad catalog.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

The missing fields part is where I almost tripped up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the matching semantics: treat missing rule fields as wildcards (always match) and define how AND/OR compose per-field checks. Then propose an efficient data structure, such as inverted indexes on each attribute, to quickly retrieve candidate ads for repeated lookups against a static catalog.

Pro tip: Mention that for a static catalog, you can precompute and cache the inverted indexes, and for AND queries, intersect the smallest result sets first to minimize work. Also note that missing fields should be treated as 'match all' to avoid excluding ads unintentionally.

1. Clarify matching semantics

Confirm that missing rule fields mean 'no constraint' (wildcard) and that AND requires all present fields to match, while OR requires at least one present field to match. If all fields are missing, decide whether to return all ads or none based on business rules.

2. Design per-field checks

For each rule field, write a predicate that returns true if the field is missing or if the ad's attribute satisfies the condition. For range fields like age, check if the ad's range overlaps the rule's range; for location, check set intersection.

3. Compose checks with AND/OR

Combine the per-field predicates using logical AND or OR. For AND, all predicates must be true; for OR, at least one must be true. Handle the edge case where no fields are present (return all or none).

4. Optimize with data structures

Build inverted indexes mapping each attribute value (or range bucket) to a list of ad IDs. For AND queries, intersect the smallest lists first; for OR, union the lists. Use bitsets for fast set operations if the catalog is large.

5. Discuss trade-offs and scalability

Compare linear scan vs. indexed lookup: indexing speeds up repeated queries but uses memory and build time. For static catalogs, precompute indexes; for dynamic, consider incremental updates or caching.

Key Points to Mention

  • Missing rule fields should be treated as wildcards (always match) to avoid over-filtering.
  • AND vs OR composition: AND requires all present fields to match; OR requires at least one.
  • For range fields like age, use interval overlap logic; for location, use set intersection.
  • Inverted indexes on each attribute enable fast candidate retrieval for repeated queries.
  • For AND queries, intersect smallest result sets first to minimize work; for OR, union sets.
  • Use bitsets for compact storage and fast bitwise operations when the catalog is large.

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