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.
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.
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/mathematics...