Why my code is not passing all test cases?

The link to my code: https://ide.codingblocks.com/s/239737

The difference b/w my code and instructor’s is that I am using hashmap instead of the array.

hello @siddharth_1_3277
image
you should add res to ur final answer and then print ur final answer outside the loop.

check ur updated code here -> https://ide.codingblocks.com/s/239772

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.