Delete And Earn


This is really an elegant problem. As indicated by the first example, i.e., [2,3,4], the order of taking the numbers is also very crucial.
In this example, if one pick 3 as the first number, the other numbers,, i.e., 2 and 4 are to be deleted and 3 will be the result. However, if one pick 2 first, 3 is going to be deleted, and 4 can still be picked, and therefore, the optimum answer 6 is achieved.

@maverick247 I think that is discussed as a variant in the Java solution of Approach #1
@rriskhh Thanks for the tip, I will think about how best to add this