My approach to this problem is not working
Ik this code fails for ((a+b)) , but i also know i am somewhat close to the answer, can you guide me further using my appoach and my code.
My approach to this problem is not working
Ik this code fails for ((a+b)) , but i also know i am somewhat close to the answer, can you guide me further using my appoach and my code.
Hi @nishchay-verma… firstly sry in delay… so what u can do is maintain a stack of char as u are doing. now if string has any character other than a closing bracket ‘)’ simply push it in ur stack. else what u do when u have a closing bracket u maintain a cnt variable to 0. now u start popping till u get a closing bracket. if cnt is still zero this means bracket was redundant and u break and print duplicate else u continue…
refer this code https://ide.codingblocks.com/s/587770
if u still face any difficulty msg back here.
ooh yess i got it…
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.