062 - Unique Paths
来源:互联网 发布:最新网络流行歌曲 编辑:程序博客网 时间:2024/06/06 12:22
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.
int uniquePaths(int row, int col){ if (!row || !col) return 0;int tmp[2][100];int *p1 = tmp[0];int *p2 = tmp[1];int i;for (i = 0; i < col; i++) tmp[0][i] = tmp[1][i] = 1;int level, loop;for (level = 1; level < row; level++) {for (loop = 1; loop < col; loop++) {p2[loop] = p1[loop] + p2[loop - 1];}int *swap = p1;p1 = p2;p2 = p1;}return p2[col - 1];}
0 0
- LeetCode 062 Unique Paths
- LeetCode 062 Unique Paths
- LeetCode 062 Unique Paths
- 062 - Unique Paths
- leetcode 062 Unique Paths
- LeetCode 062 Unique Paths
- LeetCode: Unique Paths II [062]
- leetcode_c++:Unique Paths(062)
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- Unique Paths
- jQuery学习--jQuery CSS 操作
- 备忘录实现过程
- com.google.protobuf.InvalidProtocolBufferException: Message missing required fields: callId, status
- AOP(3)
- mysql 查看binlog 操作日志及恢复数据
- 062 - Unique Paths
- 一张网页从meta标签开始
- POJ-2456Aggressive cows
- 5-4 BCD解密
- 初探CentOS搭建SVN服务器
- java集合:线性表
- angularjs指令link函数参数scope,指令controller依赖注入的$scope,与指令外部controller的$scope的关系
- tomcat7监听端口 改为 80 linux Debian
- Java 1.7 语法新特性