What is the issue here?

Hi. I can see u have already successfully submitted the code and gained full points.

if u still have any doubts u can refer this https://ide.codingblocks.com/s/582012

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.

this is the second approach , I want to know why this was failing

for that approach only see this https://ide.codingblocks.com/s/582012

bro this is the same code as in vid, please can yopuo tell whats wrong with my code

then pls explain what exactly are u trying to do

upated the code please check

i am asking explain me what u are exactly trying to do. explain me ur approach so that i can figure out the mistake

when im getting a new element im putting in the map else if it was previously present then im calculating the ans for it

just dry run for 1 2 3 1 4

when i got the second 1 I’ll calulate the ans for first 1 as it wont contibute further

5
1 1 2 2 1
check for this input. ur ans is wrong

oh thanks got it …

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.