Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Understanding combinatorics questions
Post Flair (click to view more posts with a particular flair)
Post Body

Hi to all of you :)

Even though I am decent at coding usually math heavy questions in tests get me. For instance this question:

Have the function BracketCombinations(num) read num which will be an integer greater than or equal to zero, and return the number of valid combinations that can be formed with num pairs of parentheses. For example, if the input is 3, then the possible combinations of 3 pairs of parenthesis, namely: ()()(), are ()()(), ()(()), (())(), ((())), and (()()). There are 5 total combinations when the input is 3, so your program should return 5.

The answer is:

int(factorial(2 * num) / (factorial(num   1) * factorial(num)))

I can understand the factorial(2 * num) part but rest is mystery. Can you explain it? or better direct me to resources that I can learn these concepts in depth with lots of examples, sample questions etc. It really bothers me if the part I am stuck is math in a coding test.

Author
User Disabled
Account Strength
0%
Disabled 2 months ago
Account Age
4 years
Verified Email
Yes
Verified Flair
No
Total Karma
480
Link Karma
212
Comment Karma
268
Profile updated: 2 days ago
Posts updated: 2 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago