Why can’t I sort the array and multiply it with the year?
For ex - 11+22+33+44+5*5=55(max profit)
Doubt in greedy approach
The rule of the game is to pick bottles from any end of the array.
So if you sort the array , the ordering will be disturbed. You have to follow the same order as giving in the input
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.