DEV Community

loading...

Discussion on: Daily Challenge #203 - Pascal's Triangle

Collapse
vidit1999 profile image
Vidit Sarkar

Python one-liner using recursion

easyLine = lambda n : 1 if n==0 else int((2*(2*n-1)/n)*easyLine(n-1))

Because,

easyLine(n) = 2*(2*n-1)/n * easyLine(n-1) when n > 0
            = 1 when n=0