Football Player - Total Dribble Paths
Coding Problem Keys
Football Player - Total Dribble Paths
Problem Statement
A football coach wants his team to improve their dribbling skills. So he sets up a R*C grid, where R is the number of rows and C is the number of columns. From any given cell, a player can only dribble to the right cell or bottom cell.
A player always starts from top left most cell and must end at bottom right most cell where he can collect the reward if he has dribbled according to the rules above.
The program must accept R, C and print the total number of possible paths P in which a player can reach the destination.
Boundary Condition(s)
Input Format
Output Format
Example Input/Output 1
Input
Output
Example Input/Output 2
Input
Output
Example Input/Output 3
Input
Output
Note: Max Execution Time Limit: 5000 millisecs
Solution
Programming Language: Python 3 Language
n=int(input())
m=int(input())
c=[[0 for i in range(m)] for i in range(n)]
for i in range(n):
c[i][0]=1
for j in range(m):
c[0][j]=1
for i in range(1,n):
for j in range(m):
c[i][j]=c[i-1][j]+c[i][j-1]
print(c[n-1][m-1])
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments