@ankur: dp[i][j] number of (prefix) strings that have i As and j Bs is:
dp[i-1][j] number of (prefix) strings that have i-1 As and j Bs appended by
"A"
+
dp[i][j-1] number of (prefix) strings that have i As and j-1 Bs appended by
"B"


@ashish: wikipedia has some nice proofs for catalan number formula:
en.wikipedia.org/wiki/Catalan_number

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to