-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path62.不同路径.py
More file actions
53 lines (51 loc) · 1.12 KB
/
62.不同路径.py
File metadata and controls
53 lines (51 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# @lc app=leetcode.cn id=62 lang=python
#
# [62] 不同路径
#
# https://leetcode-cn.com/problems/unique-paths/description/
#
# algorithms
# Medium (56.01%)
# Likes: 323
# Dislikes: 0
# Total Accepted: 40.4K
# Total Submissions: 71.7K
# Testcase Example: '3\n2'
#
# 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。
#
# 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。
#
# 问总共有多少条不同的路径?
#
#
#
# 例如,上图是一个7 x 3 的网格。有多少可能的路径?
#
# 说明:m 和 n 的值均不超过 100。
#
# 示例 1:
#
# 输入: m = 3, n = 2
# 输出: 3
# 解释:
# 从左上角开始,总共有 3 条路径可以到达右下角。
# 1. 向右 -> 向右 -> 向下
# 2. 向右 -> 向下 -> 向右
# 3. 向下 -> 向右 -> 向右
#
#
# 示例 2:
#
# 输入: m = 7, n = 3
# 输出: 28
#
#
class Solution(object):
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""