Data Structure & Algorithm: Level-1 Problem #58. Factorial and Permutation-2

Given the position for two points A and B on the Cartesian plane. Find out how many ways to move from point A to point B to achieve the shortest distance, while we can only move in horizontal or vertical directions.

Factorial and Permutation

Sample Input:

A = (1, 1), B = (7, 8)

Sample Output:

1716


数据结构和算法:初级练习题 #58 阶乘和排列 (二)


给定平面坐标上的两个点 A 和 B,如果只能沿水平或垂直方向移动,计算从A到B的最短路线总共有多少种不同的走法。

输入样例:

A = (1, 1),B = (7, 8)

输出样例:

1716


Python Solution

Factorial And Permutation