i have a given a triangle grid:
For every point (i,j) with i+j being even:
Now i need to write a iterative function that finds all possible paths from (0,0) to the point (2n,0) given that n ∈ N.
So my idea, written in pseudo code:
def path (i,j):
paths = set()
A = [ 1 for x in range(j)]
for x in range (i - len(A)):
A.append (last)-(-1)
A.append (-1)
set.append(path)
for i in range (i!):
candidate = permutate(A)
for i in range(len(A)):
if sum (A [1: i]) < 0
break
Paths.append(candidate)
return len(paths)
i need to count the total amount of paths possible to (2n,0)