国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 界首市| 龙门县| 利川市| 灵宝市| 昌邑市| 三都| 岑溪市| 黔西| 大港区| 鄄城县| 利川市| 南康市| 遂宁市| 武宣县| 马山县| 泰安市| 余干县| 常熟市| 连城县| 商都县| 吐鲁番市| 玛沁县| 武穴市| 临漳县| 钦州市| 泊头市| 安仁县| 襄垣县| 南京市| 台前县| 石渠县| 霸州市| 安西县| 延边| 延川县| 长垣县| 织金县| 海淀区| 蒙阴县| 淅川县| 长岛县|