Pregunta de entrevista de Oracle

Algorithm to print all valid open and close parenthesis? (leetcode question)