← Pinterest Interview Insights

Pinterest·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Pinterest ML engineer interview with a system design problem around hierarchical access control. The problem itself was clean but the follow-up complexity snuck up on me.

Questions Asked (1)

Q1

Design a class that manages advertiser permissions on a group hierarchy tree, supporting grant, revoke, and check access operations where permissions propagate from parent nodes to all descendants.

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

The basic structure came together fine, grant and revoke are just set operations on a per-advertiser collection of group IDs, and check_access walks up the tree comparing ancestors.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a tree data structure with permission propagation. Discuss trade-offs between eager and lazy propagation, and outline operations with time/space complexity. Finally, address scalability and consistency for large hierarchies.

Pro tip: Mention that in real systems like Pinterest, permissions are often cached with TTL and invalidated on updates to balance performance and consistency. Also, consider using a bitmask for permissions to allow efficient checks and updates.

1. Clarify Requirements

Ask about tree size, update/query frequency, consistency requirements, and whether permissions can be overridden at lower levels. This shows you think about practical constraints.

2. Design Data Structure

Propose a tree where each node stores its own permissions and a reference to its parent. Discuss storing effective permissions (propagated) vs. computing on the fly.

3. Implement Operations

For grant/revoke, update the node's permissions and propagate to descendants if eager, or mark dirty if lazy. For check, traverse up to root or use cached effective permissions.

4. Analyze Trade-offs

Compare eager vs. lazy propagation: eager gives O(1) checks but O(subtree) updates; lazy gives O(depth) checks but O(1) updates. Discuss hybrid approaches like caching.

5. Address Scalability

Discuss handling large trees with millions of nodes: use efficient traversal, batch updates, and consider distributed caching or sharding. Mention consistency models (e.g., eventual consistency).

Key Points to Mention

  • Tree traversal algorithms (DFS/BFS) for propagation
  • Permission inheritance and override semantics
  • Time and space complexity of operations
  • Caching strategies and invalidation
  • Concurrency control for simultaneous updates
  • Use of bitmasks for efficient permission representation

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