Please tell me what i am doing wrong
Hi @sarthaksinghyour code is wrong because you are taking 3 separate stacks due which if sequence is ( [ ) ] then your code will first push ( in s1 and [ in s2 and then pop out ) from s1 and ] from s2 and will return true but this string does not contain balanced parenthesis. So you have to take a single stack if the current element is equal to s.top() then only you will pop the element else you will return false.