in just starting of this video … question about vikrant and Kunal is discussed…I am not able to understand the statement of the question…please help…and if there is a link to this problem then please provide…
In just starting of this video .. question about vikrant and Kunal is discussed..I am not able to understand the statement of the question...please help...and if there is a link to this problem then please provide
@kaushikjatin You are given an array of number, Vikrant and Kunal now start playing a game using that array.
Rules of the game are: Vikrant can pick any available number. Let say he picks a
He will get points for the number = frequency_of_number* number
And all the occurences of the picked number will be removed.
Now Kunal will remove all the occurrence of a-1 and a+1 (if present).
Now vikrant again will pick a number from the remaining array and whole process will repeat till no elements are left.
eg array is 4 1 0 1 1 2 3 3 4 0 4
Now if Vikrant picks 4.
Score= 4 * fre_of_4= 4*3=12
Now the array is (4 removed)
1 0 1 1 2 3 3 0
Now kunal will remove a-1(4-1=3) and a+1(4+1=5). Now array becomes
1 0 1 1 2 0 (as only 3 is present we remove it)
Now its turn of Vik again
He picks 1
new array
0 2
score=1*3
accumulated score= prev_score+score=3+12=15
kunal removes 0(1-1) and 2(1+1)
now no element left game ends.
final score is 15.
We need to maximize the final score.
If this resolves your doubt mark it as resolved.
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.