TheAlgorithms-Python/dynamic_programming/Non-crossing-lines-to-connect-points-in-a-circle

11 lines
272 B
Plaintext

def count(n):
if (n & 1):
return 0
val = n // 2
dy_lst = [1 for i in range(val + 1)]
for i in range(2, val + 1):
dy_lst[i] = 0
for j in range(i):
dy_lst[i] += (dy_lst[j] * dy_lst[i - j - 1])
return dy_lst[val]