Greedy Florist

  • + 0 comments
    1. Sort array ascending which is default.
    2. Make multiple groups of k elements each, from right to left.
    3. Iterate left to right within each group.
    4. Increase previous purchase by one after iterating each group.