The code is working properly for the input test case but not for any of the hidden test cases.
Test case error
Change line no 26 to
if(m.count(chk)==0)
and replace line no 29 by No, instead of Yes
Please explain why.I did not understand the logic and its not working that way . Please check if I have made the correct changes. https://ide.codingblocks.com/s/89977
Yes your changes are fine, try to submit your code
Read the question carefully and try to understand that you will need a new map for every test case and you are making only one map for all the test cases. Apart from this update your code’s line:20 as while(q>0)
.
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.