原文链接: https://leetcode-cn.com/problems/generate-random-point-in-a-circle 英文原文Given the radius and the position of the center of a circle, implement the function randPoint which generates a uniform random point inside the circle. Implement the Solutio…
标签详情
数学 分类
原文链接: https://leetcode-cn.com/problems/projection-area-of-3d-shapes 英文原文You are given an n x n grid where we place some 1 x 1 x 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v cubes placed on…
原文链接: https://leetcode-cn.com/problems/super-egg-drop 英文原文You are given k identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there exists a floor f where 0 <= f <= n such that any egg dropped at a floor …
原文链接: https://leetcode-cn.com/problems/sum-of-subsequence-widths 英文原文The width of a sequence is the difference between the maximum and minimum elements in the sequence. Given an array of integers nums, return the sum of the widths of all the non-empt…
原文链接: https://leetcode-cn.com/problems/surface-area-of-3d-shapes 英文原文You are given an n x n grid where you have placed some 1 x 1 x 1 cubes. Each value v = grid[i][j] represents a tower of v cubes placed on top of cell (i, j). After placing these cub…
原文链接: https://leetcode-cn.com/problems/orderly-queue 英文原文You are given a string s and an integer k. You can choose one of the first k letters of s and append it at the end of the string.. Return the lexicographically smallest string you could have af…
原文链接: https://leetcode-cn.com/problems/numbers-at-most-n-given-digit-set 英文原文Given an array of digits which is sorted in non-decreasing order. You can write numbers using each digits[i] as many times as we want. For example, if digits = ['1','3','5']…
原文链接: https://leetcode-cn.com/problems/super-palindromes 英文原文Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome. Given two positive integers left and right represented as strings, retur…
原文链接: https://leetcode-cn.com/problems/smallest-range-i 英文原文You are given an integer array nums and an integer k. In one operation, you can choose any index i where 0 <= i < nums.length and change nums[i] to nums[i] + x where x is an integer from the…
原文链接: https://leetcode-cn.com/problems/smallest-range-ii 英文原文You are given an integer array nums and an integer k. For each index i where 0 <= i < nums.length, change nums[i] to be either nums[i] + k or nums[i] - k. The score of nums is the differenc…
原文链接: https://leetcode-cn.com/problems/cat-and-mouse 英文原文A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follows: graph[a] is a list of all nodes b such that ab is an edge of the graph…
原文链接: https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards 英文原文In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more gr…
原文链接: 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/three-equal-parts 英文原文You are given an array arr which consists of only zeros and ones, divide the array into three non-empty parts such that all of these parts represent the same binary value. If it is possible…
原文链接: https://leetcode-cn.com/problems/beautiful-array 英文原文An array nums of length n is beautiful if: nums is a permutation of the integers in the range [1, n]. For every 0 <= i < j < n, there is no index k with i < k < j where 2 * nums[k] == nums[i]…
原文链接: https://leetcode-cn.com/problems/minimum-area-rectangle 英文原文You are given an array of points in the X-Y plane points where points[i] = [xi, yi]. Return the minimum area of a rectangle formed from these points, with sides parallel to the X and Y…
原文链接: https://leetcode-cn.com/problems/di-string-match 英文原文A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: s[i] == 'I' if perm[i] < perm[i + 1], and s[i] == 'D' if perm[…
原文链接: https://leetcode-cn.com/problems/largest-component-size-by-common-factor 英文原文You are given an integer array of unique positive integers nums. Consider the following graph: There are nums.length nodes, labeled nums[0] to nums[nums.length - 1], T…
原文链接: https://leetcode-cn.com/problems/prison-cells-after-n-days 英文原文There are 8 prison cells in a row and each cell is either occupied or vacant. Each day, whether the cell is occupied or vacant changes according to the following rules: If a cell ha…
原文链接: https://leetcode-cn.com/problems/minimum-area-rectangle-ii 英文原文You are given an array of points in the X-Y plane points where points[i] = [xi, yi]. Return the minimum area of any rectangle formed from these points, with sides not necessarily pa…
原文链接: https://leetcode-cn.com/problems/least-operators-to-express-number 英文原文Given a single positive integer x, we will write an expression of the form x (op1) x (op2) x (op3) x ... where each operator op1, op2, etc. is either addition, subtraction, …
原文链接: https://leetcode-cn.com/problems/powerful-integers 英文原文Given three integers x, y, and bound, return a list of all the powerful integers that have a value less than or equal to bound. An integer is powerful if it can be represented as xi + yj fo…
原文链接: https://leetcode-cn.com/problems/equal-rational-numbers 英文原文Given two strings s and t, each of which represents a non-negative rational number, return true if and only if they represent the same number. The strings may use parentheses to denote…
原文链接: https://leetcode-cn.com/problems/k-closest-points-to-origin 英文原文Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0). The distance between two…
原文链接: https://leetcode-cn.com/problems/largest-perimeter-triangle 英文原文Given an integer array nums, return the largest perimeter of a triangle with a non-zero area, formed from three of these lengths. If it is impossible to form any triangle of a non-…
原文链接: https://leetcode-cn.com/problems/add-to-array-form-of-integer 英文原文The array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321, the array form is [1,3,2,1]. Given num, the array-form o…
原文链接: https://leetcode-cn.com/problems/broken-calculator 英文原文There is a broken calculator that has the integer startValue on its display initially. In one operation, you can: multiply the number on display by 2, or subtract 1 from the number on displ…
原文链接: https://leetcode-cn.com/problems/number-of-squareful-arrays 英文原文An array is squareful if the sum of every pair of adjacent elements is a perfect square. Given an integer array nums, return the number of permutations of nums that are squareful. …
原文链接: https://leetcode-cn.com/problems/clumsy-factorial 英文原文The factorial of a positive integer n is the product of all positive integers less than or equal to n. For example, factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1. We make a clumsy f…
原文链接: https://leetcode-cn.com/problems/numbers-with-repeated-digits 英文原文Given an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit. Example 1: Input: n = 20 Output: 1 Explanation: The only pos…