← 返回 coinbase 的题目列表Onsite Coding: Block Mining with Dependencies (Max Fee under Size Constraint)
类型:online_judge
You are given a set of transactions (or blocks) to include in a block. Each transaction has:
id
fee
size
dependencies: some transactions have a parent; selecting a transaction requires selecting all of its ancestor transactions
Given a maximum block capacity MAX_SIZE, select a subset of transactions whose total size does not exceed MAX_SIZE, maximizing total fee, while satisfying the dependency constraints.
(From the post: candidates may consider greedy by fee/size and DFS to collect dependency paths for evaluation.)
I/O format and constraints: not provided; interviewer had hidden I/O; follow the provided interface.