human
Counts paths from a point to reach Origin : Memory Optimized | Function to count the paths from a point to the origin.
Base Case when the point is already at origin.
Base Case when the point is on the x or y - axis.
Loop to fill all the position as 1 in the array.
Loop to count the number of paths from a point to origin in bottom - up manner.
Driver Code.
Function call"
How can the above be solved in Python?

=====
Write me a code to counts paths from a point to reach Origin : Memory Optimized and the other steps required?
assistant
#Here is code to counts paths from a point to reach Origin : Memory Optimized and the other steps required.
 def Count_Paths ( x , y ) :
	if ( x == 0 and y == 0 ) :
		return 0
	if ( x == 0 and y == 0 ) :
		return 1
	dp = [ 0 ] * ( max ( x , y ) + 1 )
	p = max ( x , y )
	q = min ( x , y )
	for i in range ( p + 1 ) :
		dp [ i ] = 1
	for i in range ( 1 , q + 1 ) :
		for j in range ( 1 , p + 1 ) :
			dp [ j ] += dp [ j - 1 ]
	return dp [ p ]
x = 3
y = 3
print ( " Number ▁ of ▁ Paths ▁ " , Count_Paths ( x , y ) )