Doubt in the question

By searching through previously asked doubts, I figured out and understood the solution to the problem. However, my concern is that I am sure that I won’t be able to think of such a solution without any help if this question is asked in an interview. Any study material or practice questions that you would suggest to master greedy problems like this?