I can’t think of the approach to solve this problem
I can't think of the approach to solve this problem
Approach ( O(n^3) time complexity )
Number of entries in every line is equal to line number.
For example, the first line has 1 number “1”,
the second line has 2 numbers “1 1”,
the third line has 3 numbers “1 2 1”,… and so on.
Every entry in a line is value of a Binomial Coefficient.
The value of i th entry in line number line is C(line, i) . The value can be calculated using following formula.
C(line, i) = line! / ( (line-i)! * i! )