62. Unique Paths
来源:互联网 发布:杭州龙翔桥到淘宝城 编辑:程序博客网 时间:2024/06/11 20:19
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
How many possible unique paths are there?
Above is a 3 x 7 grid. How many possible unique paths are there?
Note: m and n will be at most 100.
Subscribe to see which companies asked this question.
解析:
class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int> > path(m, vector<int>(n, 1));
for(int i = 1; i < m; i ++)
{
for(int j = 1; j < n; j ++)
{
path[i][j] = path[i-1][j] + path[i][j-1];
}
}
return path[m-1][n-1];
}
};
- 62. Unique Paths && 63. Unique Paths II
- 62. Unique Paths \ 63. Unique Paths II
- [LeetCode]62.Unique Paths
- LeetCode --- 62. Unique Paths
- LeetCode 62.Unique Paths
- [Leetcode] 62. Unique Paths
- [leetcode] 62.Unique Paths
- 62. Unique Paths
- [leetcode] 62.Unique Paths
- leetcode 62. Unique Paths
- Leetcode 62. Unique Paths
- [leetcode] 62. Unique Paths
- 62. Unique Paths LeetCode
- 62. Unique Paths
- 62. Unique Paths
- [LeetCode]62. Unique Paths
- 【LeetCOde】62. Unique Paths
- [LeetCode]62. Unique Paths
- 【qscoj】喵哈哈村的嘟嘟熊魔法(3)
- (OK) ping6 ipv6-address
- Kubernetes编排工具-helm中使用grpc
- 假如你想成为全栈工程师…
- 【源码剖析】threadpool —— 基于 pthread 实现的简单线程池
- 62. Unique Paths
- Non-abundant sums
- 系统恢复技术-内核出现问题,如何修复
- 排序算法06:快速排序
- 二叉树的实现-Huffman树-摘自数据结构实现java版本(个人笔记整理)
- javascript 用户代理字符串检测技术-
- BeanFactory和ApplicationContext的介绍
- Windows 7+Sublime Text 3配置C/C++开发环境
- HDOJ--1865 1string +HDOJ--2504 A==B? +Problem B