Back to problems

Maximize Transaction Fees in Block

Algorithm · Coinbase · Medium

You are a blockchain miner preparing a new block. You have a list of pending transactions, each with a unique identifier, a size in bytes, and a fee that you will collect if the transaction is included in the block. The block has a fixed capacity of exactly 100 bytes. Your task is to choose a subset of the transactions to include in the block such that the total size of the selected transactions does not exceed the block capacity, and the total fee is as large as possible.…

Checking your access…