首页 > 其他分享 >[LeetCode][62]unique-paths

[LeetCode][62]unique-paths

时间:2023-08-18 15:26:09浏览次数:39  
标签:paths right int robot Down 62 corner unique

Content

There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.

Given the two integers m and n, return the number of possible unique paths that the robot can take to reach the bottom-right corner.

The test cases are generated so that the answer will be less than or equal to 2 * 109.

 

Example 1:

Input: m = 3, n = 7
Output: 28

Example 2:

Input: m = 3, n = 2
Output: 3
Explanation: From the top-left corner, there are a total of 3 ways to reach the bottom-right corner:
1. Right -> Down -> Down
2. Down -> Down -> Right
3. Down -> Right -> Down

 

Constraints:

  • 1 <= m, n <= 100
Related Topics
  • 数学
  • 动态规划
  • 组合数学

  • 标签:paths,right,int,robot,Down,62,corner,unique
    From: https://www.cnblogs.com/shea24/p/17640602.html
  • 相关文章

    • LeetCode[64]MinimumPathSum
      ContentGivenamxngridfilledwithnon-negativenumbers,findapathfromtoplefttobottomright,whichminimizesthesumofallnumbersalongitspath.Note:Youcanonlymoveeitherdownorrightatanypointintime. Example1:Input:grid=[[......
    • LeetCode[62]UniquePaths
      ContentThereisarobotonanmxngrid.Therobotisinitiallylocatedatthetop-leftcorner(i.e.,grid[0][0]).Therobottriestomovetothebottom-rightcorner(i.e.,grid[m-1][n-1]).Therobotcanonlymoveeitherdownorrightatanypointi......
    • Atcoder_[abc284E]Count Simple Paths题解
      题目链接这题就是很简单的图上深搜,我觉得放在E题太水了,代码里有详细注释。#include<bits/stdc++.h>usingnamespacestd;#defineintlonglongvector<int>v[200010];//邻接表intans;//答案boolvis[200010];//vis[i]记录i号点有没有被访问过voiddfs(intx)......
    • No_62_UniquePaths
      ContentThereisarobotonanmxngrid.Therobotisinitiallylocatedatthetop-leftcorner(i.e.,grid[0][0]).Therobottriestomovetothebottom-rightcorner(i.e.,grid[m-1][n-1]).Therobotcanonlymoveeitherdownorrightatanypointi......
    • 【剑指Offer】62、二叉搜索树的第k个结点
      【剑指Offer】62、二叉搜索树的第k个结点题目描述:给定一棵二叉搜索树,请找出其中的第k小的结点。例如(5,3,7,2,4,6,8)中,按结点数值大小顺序第三小结点的值为4。解题思路:本题实际上比较简单,主要还是考察对树的遍历的理解,只要熟练掌握了树的三种遍历方式及其特点,解决本题并不复杂,很明显......
    • CF1762D GCD Queries 题解
      题面给定一个长度为\(n\)的排列\(0,1,\cdots,n-1\)。可以进行最多\(2n\)次询问,每次询问给出两个下标\(i,j\),交互器会返回\(\gcd(p_i,p_j)\)。询问以后,需要输出两个下标\(x,y\),满足\(p_x=0\lorp_y=0\)。特别地,\(\gcd(0,x)=x\)。题解观察次数限制,我们......
    • C# 获取Windows系统设备唯一标识方法及代码(Unique Identifier)
      唯一的标识一个设备是一个基本功能,可以拥有很多应用场景,比如软件授权(如何保证你的软件在授权后才能在特定机器上使用)、软件License,设备标识,设备身份识别等。一、网卡MAC地址     MAC地址可能是最常用的标识方法,但是现在这种方法基本不可靠:一个电脑可能存在多个网卡,多个......
    • FP6298支持9V输出异步升压芯片,3-5V升压到5V/9V
      FP6298低噪声4.5A升压型电流模式PWM转换器。FP6298是电流模式的升压型DC-DC转换器。这是PWM电路,内置0.08Ω功率MOSFET,使该稳压器高节能。内部补偿网络也最大限度地减少了多达6个外部元件数量。误差放大器的非反相输入端连接到一个0.6V的精确的参考电压,内部软启动功能,可以减少浪涌电......
    • VTK 实例62:点云配准
      1#include<vtkAutoInit.h>2VTK_MODULE_INIT(vtkRenderingOpenGL2);3VTK_MODULE_INIT(vtkRenderingFreeType);4VTK_MODULE_INIT(vtkInteractionStyle);56#include<vtkPoints.h>7#include<vtkSmartPointer.h>8#include<......
    • next.js 源码解析 - getStaticProps、getStaticPaths 篇
      ......