Growfin interview question

2 programming questions on Greedy approach