原文链接: https://leetcode-cn.com/problems/unique-paths 英文原文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 t…
标签详情
组合数学 分类
原文链接: https://leetcode-cn.com/problems/poor-pigs 英文原文There are buckets buckets of liquid, where exactly one of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die…
原文链接: https://leetcode-cn.com/problems/kth-smallest-instructions 英文原文Bob is standing at cell (0, 0), and he wants to reach destination: (row, column). He can only travel right and down. You are going to help Bob by providing instructions for him to r…
原文链接: https://leetcode-cn.com/problems/number-of-music-playlists 英文原文Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that: Ev…
原文链接: https://leetcode-cn.com/problems/count-ways-to-build-rooms-in-an-ant-colony 英文原文You are an ant tasked with adding n new rooms numbered 0 to n-1 to your colony. You are given the expansion plan as a 0-indexed integer array of length n, prevRoom,…
原文链接: https://leetcode-cn.com/problems/probability-of-a-two-boxes-having-the-same-number-of-distinct-balls 英文原文Given 2n balls of k distinct colors. You will be given an integer array balls of size k where balls[i] is the number of balls of color i. A…
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-reorder-array-to-get-same-bst 英文原文Given an array nums that represents a permutation of integers from 1 to n. We are going to construct a binary search tree (BST) by inserting the elements of nu…
原文链接: https://leetcode-cn.com/problems/sum-of-all-subset-xor-totals 英文原文The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1. Giv…
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-rearrange-sticks-with-k-sticks-visible 英文原文There are n uniquely-sized sticks whose lengths are integers from 1 to n. You want to arrange the sticks such that exactly k sticks are visible from t…
原文链接: https://leetcode-cn.com/problems/vowels-of-all-substrings 英文原文Given a string word, return the sum of the number of vowels ('a', 'e', 'i', 'o', and 'u') in every substring of word. A substring is a contiguous (non-empty) sequence of characters w…
原文链接: https://leetcode-cn.com/problems/zui-xiao-ju-xing-mian-ji 英文原文 中文题目二维平面上有 $N$ 条直线,形式为 `y = kx + b`,其中 `k`、`b`为整数 且 `k > 0`。所有直线以 `[k,b]` 的形式存于二维数组 `lines` 中,不存在重合的两条直线。两两直线之间可能存在一个交点,最多会有 $C_N^2$ 个交点。我们用一个平行于坐标轴的矩形覆盖所有的交点,请问这个矩形最小面积是多少。若直线之间无交点…
原文链接: https://leetcode-cn.com/problems/Uh984O 英文原文 中文题目小扣在秋日市集购买了一个古董键盘。由于古董键盘年久失修,键盘上只有 26 个字母 **a~z** 可以按下,且每个字母最多仅能被按 `k` 次。 小扣随机按了 n 次按键,请返回小扣总共有可能按出多少种内容。由于数字较大,最终答案需要对 1000000007 (1e9 + 7) 取模。 示例 1: 输入:k = 1, n = 1 输出:26 解释:由于只能按一次按键,所有可能的字符串为 …
原文链接: https://leetcode-cn.com/problems/2AoeFn 中文题目一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为 “Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为 “Finish” )。 问总共有多少条不同的路径? 示例 1: 输入:m = 3, n = 7 输出:28 示例 2: 输入:m = 3, n = 2 输出:3 解释: 从左上角开…