Official algorithmic problem description and constraints.
Chef knows the projected sales of his store for the next N days. The projected sales of the ith day is Ai.
On any particular day, Chef can announce that his shop is closing which will double his sales for that day, but since Chef is a man of his word, he won't make any sale after that day.
Find the maximum possible total sales which Chef can make.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.