ques:https://online.codingblocks.com/player/1972/content/896
i have some error in my logic can someone correct it
for ques and alice & bob code:https://ide.codingblocks.com/#/s/13786
Alice is playing a weird game. Given a sequence ‘a’ consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let’s denote it ak) and delete it, at that all elements equal to ak + 1 and ak - 1 also must be deleted from the sequence. That step brings ak points to the player.
Help Alice to get maximum points.
Input Format:
First line contains an integral value denoting size of array ‘n’. Second line contains the array elements.
Constraints:
1<=n<=10^5 1<=a[i]<=10^5
Output Format
Single integer denoting the maximum value that Alice could have.
Sample Input
8 7 2 1 8 3 3 6 6
Sample Output
27