PLease check
Test case fail Java doubt
your code is not printing any output
I have considered visited array now. still not working. please check https://ide.codingblocks.com/s/465567
replyyyyyyyyyyyyyyyyyyyyyyyyyyyy
sorry i missed your doubt
condition you are checking is
ms.peek()-ch>0 && lastpos[ms.peek()-'a']>lastpos[ch-'a']
but correct condition is
(ms.peek()-ch>0 && lastpos[ms.peek()-'a']>i)
you have to compare it with i
also you have to removing all such characters not only 1
so use while loop instead of if condition
Modified code
understood… thanks
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.