From 98db791d372f6ceab301ff029d3dd82924dcda71 Mon Sep 17 00:00:00 2001 From: A Safari Date: Wed, 28 Nov 2018 15:54:19 -0500 Subject: [PATCH] Create Non-crossing-lines-to-connect-points-in-a-circle --- .../Non-crossing-lines-to-connect-points-in-a-circle | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 dynamic_programming/Non-crossing-lines-to-connect-points-in-a-circle diff --git a/dynamic_programming/Non-crossing-lines-to-connect-points-in-a-circle b/dynamic_programming/Non-crossing-lines-to-connect-points-in-a-circle new file mode 100644 index 000000000..a2eec0454 --- /dev/null +++ b/dynamic_programming/Non-crossing-lines-to-connect-points-in-a-circle @@ -0,0 +1,10 @@ +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]