Bkash interview question

Parentheses problem, design a system from OOP knowledge, complexity of some algorithm