← Coinbase Interview Insights

Coinbase·Software Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Coinbase technical phone screen for a software engineer role, one meaty algorithmic problem that took up most of the time. The problem looked like a knapsack variant but with dependency constraints baked in, which made it way more interesting than a standard DP warmup.

Questions Asked (1)

Q1

Given a set of transactions each with a size and fee, where some transactions have parent dependencies forming a forest of trees, select a subset that fits within a block-size budget and maximizes total fee while respecting parent-before-child ordering.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

My first instinct was tree DP, which is technically correct but I fumbled explaining the complexity.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as a knapsack variant on a forest, where each tree's feasible selections must respect parent-child ordering. Use dynamic programming over tree structures combined with knapsack capacity, and discuss trade-offs between exact DP and greedy heuristics.

Pro tip: Acknowledge that the problem is NP-hard (knapsack) and that in practice, miners use greedy fee-rate ordering with ancestor checks; showing awareness of real-world constraints (e.g., block size, mempool policies) demonstrates maturity.

1. Clarify the problem and constraints

Restate the problem: select a subset of transactions within a block-size budget, respecting parent-before-child ordering, to maximize total fee. Confirm that transactions form a forest (each has at most one parent) and that fees and sizes are positive.

2. Identify the core algorithmic challenge

Recognize this as a precedence-constrained knapsack problem on a forest, which is NP-hard. Discuss that without dependencies, it's the classic 0/1 knapsack; with dependencies, it's more complex.

3. Propose an exact solution approach

Outline a dynamic programming solution: for each tree, compute a DP table mapping total size to maximum fee, ensuring that if a child is selected, its parent is also selected. Combine trees using knapsack merging.

4. Discuss practical heuristics and trade-offs

Mention that exact DP may be too slow for large mempools; propose greedy heuristics like sorting by fee rate (fee/size) and including ancestors, or using branch-and-bound. Highlight trade-offs between optimality and speed.

5. Analyze complexity and edge cases

State time and space complexity of the DP (e.g., O(n * B^2) for tree knapsack, where B is block size). Discuss edge cases: empty set, transactions with zero size, deep trees, and disconnected components.

Key Points to Mention

  • Precedence constraints: parent must be included before child.
  • Knapsack problem: 0/1 knapsack with dependencies is NP-hard.
  • Dynamic programming on trees: combine child DP tables with parent.
  • Greedy heuristic: sort by fee rate, include ancestors, may not be optimal.
  • Complexity: O(n * B^2) for exact DP, where B is block size.
  • Real-world context: Bitcoin/Coinbase mempool policies, block size limits.

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