Coinbase interview

Anonymous User
632
Aug 25, 2024

I was asked this question in interview last week: any ideas are appreciated.
So, we have a vector of Transactions(Tid, profit, amt, parentTransactionId) and CapacityAmt. We need to return maximum total profit that can be calculated within CapacityAmt. (knapsack dp )
Part 1. Need performance efficent soln (fractional knapsack - profit/amt factor) than optimised soln(memoised dp)
Part 2. Parent Transaction must be done before doing child Transaction. 

I did part 1, but not sure how to approach part2. 
Comments (2)