@@ -0,0 +1,1349 @@
+%22%22%22%0AMethod used to show the possible combinations%0Aof pairs of parenthesis'%0A%0A@param: %7Bint%7D open_paren    %5Bnum of available open parenthesis%5D%0A@param: %7Bint%7D close_paren   %5Bnum of available closing parenthesis%5D%0A@param: %7Bint%7D balance_paren %5Bbalance of parenthesis%5D%0A@param: %7Bint%7D list_paren    %5Blist containing combination so far%5D%0A%22%22%22%0Adef paren_helper(open_paren, close_paren, balance_paren, list_paren):%0A    %0A    #Base Case: if the open number of open and close brackets = 0%0A    if open_paren + close_paren == 0:%0A        print %22%22.join(list_paren)%0A        return%0A    %0A    #Case 1: if balance %3E 0 and close brackets %3E 0%0A    if balance_paren %3E 0 and close_paren %3E 0:%0A        list_paren.append(%22)%22)%0A        paren_helper(open_paren, close_paren - 1, balance_paren - 1, list_paren)%0A        list_paren.pop()%0A        %0A    #Case 2: if there are still open brackets to be placed%0A    if open_paren %3E 0:%0A        list_paren.append(%22(%22)%0A        paren_helper(open_paren - 1, close_paren, balance_paren + 1, list_paren)%0A        list_paren.pop()%0A%0A%22%22%22%0AMethod used to determine all%0Athe possible ways of opening and%0Aclosing a number of pairs of%0Aparenthesis'%0A%0A@param: %7Bint%7D num %5Bnumber of pairs of parenthesis%5D %0A%22%22%22%0Adef paren(num):%0A    print %22Number of parenthesis = %7B0%7D%22.format(num)%0A    paren_helper(num, num, 0, %5B%5D)%0A    print %22---------------------%22%0A    %0Aparen(2)%0Aparen(3)%0A

Create Q6ParenthesisProblem.py