Which Ad Creatives Can Be Assembled From Available Assets

Last updated: November 29, 2026

Quick Overview

Each ad creative is built from a list of components, where a component is either a raw asset or another creative. Given the creatives with their component lists and the set of raw assets in stock, return every creative that can be fully assembled.

Meta
Coding & Algorithms
Software Engineer
Meta
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Each ad creative is built from a list of components, where a component is either a raw asset or another creative. Given the creatives with their component lists and the set of raw assets in stock, return every creative that can be fully assembled.

A Meta onsite question in the style of Ads Manager tooling, where carousel and collection ads are composed from images, videos, and other composed units. The interviewer checks that you model it as Kahn's algorithm seeded with the stocked assets, and that creatives in a dependency cycle are correctly excluded.

What the Interviewer Expects
  • Model components as edges from ingredient to creative
  • Seed the queue with available raw assets, not with creatives
  • Count missing components per creative and unlock at zero
  • Exclude creatives that depend on a cycle or on missing assets
  • Run in time linear in total component references
Key Topics to Cover
Kahn's algorithm
dependency resolution
BFS
in-degree
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you return the build order for each creative?
  • If each asset has limited quantity, how does the problem change?
  • How would you report the minimal set of missing assets blocking a creative?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: creatives (names), components[i] (list of names needed for creatives[i]), and stock (raw assets available in unlimited supply).
  • Output: all creatives that can be assembled, any orde...
High-Level Design

Think of every name as a node and add an edge from each component to the creative that needs it. A creative becomes buildable when all its components are available, which is exactly the in-degree-hits...


Submit Your Answer
Markdown supported