Flipkart interview question

Coding round question was based on greedy algorithms