C++ | Leetcode C++题解之第62题不同路径

题目:

题解:

class Solution {
public:
    int uniquePaths(int m, int n) {
        long long ans = 1;
        for (int x = n, y = 1; y < m; ++x, ++y) {
            ans = ans * x / y;
        }
        return ans;
    }
};

相关推荐

  1. LeetCode63 - 不同路径 II

    2024-05-03 01:26:03       67 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-03 01:26:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-03 01:26:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-05-03 01:26:03       87 阅读
  4. Python语言-面向对象

    2024-05-03 01:26:03       96 阅读

热门阅读

  1. AI 工具

    2024-05-03 01:26:03       33 阅读
  2. 一个简单的websocket服务

    2024-05-03 01:26:03       26 阅读
  3. Python实战开发及案例分析(1)——Web开发

    2024-05-03 01:26:03       29 阅读
  4. 机器学习-什么是 PCA?

    2024-05-03 01:26:03       30 阅读
  5. [leetcode]最多公共前缀

    2024-05-03 01:26:03       32 阅读
  6. 数据库索引(Mysql)

    2024-05-03 01:26:03       33 阅读