It’s not giving the desired result?
Can you checkout the editorial solution of this problem?
hi @isingh ,
Your logic is correct,in code you forgot to initialize freq array with 0.
I have marked it in comments.
Please let me know if there is any other doubt.