ques: https://hack.codingblocks.com/dcb/p/1558
code: https://ide.codingblocks.com/s/63431
I have use a map to store the distinct elements with their counts and found the answer using Bottom Up DP.
It says run error on submitting.
Also is the logic correct?