Algorithm · Coinbase · Medium
You are given a list of transactions. Each transaction contains an integer id, a positive integer size, and a positive integer fee. A block can hold transactions whose total size is at most 100. Part 1: Greedy selection without dependencies Given transactions, a list of (id, size, fee) tuples, implement the following deterministic greedy policy: Sort the transactions by fee per unit of size in descending order. When densities tie, order by larger fee first, then by smaller…
Checking your access…