国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

LeetCode 62. Unique Paths

2019-11-08 02:12:56
字體:
供稿:網(wǎng)友

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?

answer:

class Solution {public:    int uniquePaths(int m, int n) {        vector<vector<int>> grid(m,vector<int> (n,1));        for(int i = 1; i < m; i ++){            for(int j = 1; j < n; j ++){                grid[i][j] = grid[i - 1][j] + grid[i][j - 1];            }        }        return grid[m - 1][n - 1];    }};


上一篇:Shiro 認(rèn)證

下一篇:正則表達(dá)式

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 新巴尔虎右旗| 阿克| 巴马| 英超| 奇台县| 盱眙县| 康马县| 古丈县| 昔阳县| 环江| 北流市| 常山县| 商洛市| 庆阳市| 石河子市| 沙河市| 秦皇岛市| 隆尧县| 罗田县| 北票市| 道真| 许昌县| 青神县| 黔西| 宜川县| 佳木斯市| 隆德县| 永宁县| 洛南县| 广元市| 安龙县| 华坪县| 田东县| 温泉县| 云霄县| 遂宁市| 望谟县| 眉山市| 宁都县| 保德县| 嘉义县|