PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Coinbase

Select transactions to maximize fees under size

Last updated: Mar 29, 2026

Quick Overview

This question evaluates the ability to model and optimize resource allocation under capacity constraints, testing algorithmic skills in dynamic programming and combinatorial optimization for maximizing total fee.

  • medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Select transactions to maximize fees under size

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem: Max-fee block assembly You are given `N` transactions. Each transaction has: - `id` (unique) - `size` (positive integer) - `fee` (non-negative integer) A block has a maximum capacity `B` (total size). You must choose a subset of transactions to include in the block such that: - The sum of `size` of chosen transactions is `<= B` - The **sum of `fee`** is **maximized** ### Input - `N` transactions: `[(id, size, fee), ...]` - Block capacity `B` ### Output - The maximum achievable total fee, and/or the list of chosen transaction IDs. ### Constraints (example) - `1 <= N <= 2000` - `1 <= B <= 100` - `1 <= size <= B` - `0 <= fee <= 10^9` ## Follow-up: Parent/child dependencies Now each transaction may optionally have a `parent_id`. If a transaction is included, **all its ancestors must also be included**. Assume dependencies form a forest (no cycles). - Choose a valid subset within capacity `B` that maximizes total fee. Clarify what you would return if multiple optimal subsets exist (any is fine).

Quick Answer: This question evaluates the ability to model and optimize resource allocation under capacity constraints, testing algorithmic skills in dynamic programming and combinatorial optimization for maximizing total fee.

Related Interview Questions

  • Implement an In-Memory Database - Coinbase (hard)
  • Implement a Coin-Constrained Jump Strategy - Coinbase (hard)
  • Implement Game Physics and Block Mining - Coinbase (hard)
  • Compute Total Manual Distance - Coinbase (medium)
  • Implement a Flappy Bird Jump Agent - Coinbase
Coinbase logo
Coinbase
Feb 11, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
48
0
Loading...

Problem: Max-fee block assembly

You are given N transactions. Each transaction has:

  • id (unique)
  • size (positive integer)
  • fee (non-negative integer)

A block has a maximum capacity B (total size). You must choose a subset of transactions to include in the block such that:

  • The sum of size of chosen transactions is <= B
  • The sum of fee is maximized

Input

  • N transactions: [(id, size, fee), ...]
  • Block capacity B

Output

  • The maximum achievable total fee, and/or the list of chosen transaction IDs.

Constraints (example)

  • 1 <= N <= 2000
  • 1 <= B <= 100
  • 1 <= size <= B
  • 0 <= fee <= 10^9

Follow-up: Parent/child dependencies

Now each transaction may optionally have a parent_id. If a transaction is included, all its ancestors must also be included. Assume dependencies form a forest (no cycles).

  • Choose a valid subset within capacity B that maximizes total fee.

Clarify what you would return if multiple optimal subsets exist (any is fine).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Coinbase•More Software Engineer•Coinbase Software Engineer•Coinbase Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.