HashedIn by Deloitte Interview Question

They asked me solve one Backtracking(Permutation) problem in technical round one and the problem is paranthesis generated !