nilsilu95's blog

By nilsilu95, history, 9 years ago, In English
Given n .You can choose n points in a circle and you have to draw lines joining them.Condition is each point can lie in only one line and no two lines can  intersect.You have to count number of line sequences possible.A line sequence is possible when we can draw lines from each points and satisfying the condtion mentioned above.

**Constraints**
1<=n<=50

Inputs
2
Output 
1

Inputs
4
Output 
2

Inputs
6
Output 
5

How to solve this?

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

This problem can be solved using DP in O(n^3).

http://community.topcoder.com/stat?c=problem_statement&pm=7868 http://apps.topcoder.com/forums//?module=RevisionHistory&messageID=1446345

Catalan Number is the answer of the problem for a particular n if you want to solve it using math.