Why is this giving TLE as i don't even traverse it once

hello @pranjuldwivedi120568

find function , makes ur prgram slow.

no need to check whether key exist or not by default value corresponding to any key is 0. so u can simply increment the value without checking for key exist or not.

check ur updated code here->

  • List item

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.