Balaced parenthesis


what is error in it

Hi @vikashkmr519,
Your code will give incorrect answer for input [()]{}{()()}. Also, you need to enclose your stackusingarray class inside the main class and make an object of Main and then use that object to call the stackusingarray class. I have edited your code, please ping me if you aren’t able to understand. https://ide.codingblocks.com/s/147477
[()] This input is also giving incorrect answer.

why we are creating the stackUsingArrays class in the main and then calling main object , i did not understood this part

Hi @vikashkmr519,
In your code initially, you needed to define stackusingarrays class in its own file because the class name is Main. So you can’t use this class. That’s we put stackusingarrays inside main.
Now we create an object of our main class and then use this main object to create an object of stackusingarray class.

can we create stackSuingArrays class outside the main class inthis file and then use the StackusingArrays class in the main method or create the object of the stackusingArrays

That’s what you were doing initially right?