Number of ways to insert two pairs of parentheses into a string of N characters | Function to return the number of ways to insert the bracket pairs ; Driver code
function cntWays ( str , n ) { var x = n + 1 ; var ways = x * x * ( x * x - 1 ) / 12 ; return ways ; } var str = " " ; var n = str . length ; document . write ( cntWays ( str , n ) ) ;