原文链接: https://leetcode-cn.com/problems/self-dividing-numbers 英文原文A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0. A self-…
标签详情
数学 分类
原文链接: https://leetcode-cn.com/problems/monotone-increasing-digits 英文原文An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y. Given an integer n, return the largest number that is less than or equ…
原文链接: https://leetcode-cn.com/problems/reach-a-number 英文原文You are standing at position 0 on an infinite number line. There is a destination at position target. You can make some number of moves numMoves so that: On each move, you can either go left o…
原文链接: https://leetcode-cn.com/problems/prime-number-of-set-bits-in-binary-representation 英文原文Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary represe…
原文链接: https://leetcode-cn.com/problems/basic-calculator-iv 英文原文Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]), return a list of tokens representi…
原文链接: https://leetcode-cn.com/problems/global-and-local-inversions 英文原文You are given an integer array nums of length n which represents a permutation of all the integers in the range [0, n - 1]. The number of global inversions is the number of the di…
原文链接: https://leetcode-cn.com/problems/k-th-symbol-in-grammar 英文原文We build a table of n rows (1-indexed). We start by writing 0 in the 1st row. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and eac…
原文链接: https://leetcode-cn.com/problems/reaching-points 英文原文Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise. The allowed operation on…
原文链接: https://leetcode-cn.com/problems/transform-to-chessboard 英文原文You are given an n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns with each other. Return the minimum number of moves to transform …
原文链接: https://leetcode-cn.com/problems/rotated-digits 英文原文An integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is different from x. Each digit must be rotated - we cannot choose to leave it alone…
原文链接: https://leetcode-cn.com/problems/escape-the-ghosts 英文原文You are playing a simplified PAC-MAN game on an infinite 2-D grid. You start at the point [0, 0], and you are given a destination point target = [xtarget, ytarget] that you are trying to ge…
原文链接: https://leetcode-cn.com/problems/preimage-size-of-factorial-zeroes-function 英文原文Let f(x) be the number of zeroes at the end of x!. Recall that x! = 1 * 2 * 3 * ... * x and by convention, 0! = 1. For example, f(3) = 0 because 3! = 6 has no zeroe…
原文链接: https://leetcode-cn.com/problems/split-array-with-same-average 英文原文You are given an integer array nums. You should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and average(A) == average(B). Retur…
原文链接: https://leetcode-cn.com/problems/soup-servings 英文原文There are two types of soup: type A and type B. Initially, we have n ml of each type of soup. There are four kinds of operations: Serve 100 ml of soup A and 0 ml of soup B, Serve 75 ml of soup …
原文链接: https://leetcode-cn.com/problems/chalkboard-xor-game 英文原文You are given an array of integers nums represents the numbers written on a chalkboard. Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first.…
原文链接: https://leetcode-cn.com/problems/consecutive-numbers-sum 英文原文Given an integer n, return the number of ways you can write n as the sum of consecutive positive integers. Example 1: Input: n = 5 Output: 2 Explanation: 5 = 2 + 3 Example 2: Input: n…
原文链接: https://leetcode-cn.com/problems/rectangle-overlap 英文原文An axis-aligned rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the coordinate of its top-right corner. Its …
原文链接: https://leetcode-cn.com/problems/new-21-game 英文原文Alice plays the following game, loosely based on the card game "21". Alice starts with 0 points and draws numbers while she has less than k points. During each draw, she gains an integer number o…
原文链接: https://leetcode-cn.com/problems/guess-the-word 英文原文This is an interactive problem. You are given an array of unique strings wordlist where wordlist[i] is 6 letters long, and one word in this list is chosen as secret. You may call Master.guess(…
原文链接: https://leetcode-cn.com/problems/mirror-reflection 英文原文There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining corners, numbered 0, 1, and 2. The squar…
原文链接: https://leetcode-cn.com/problems/random-pick-with-blacklist 英文原文You are given an integer n and an array of unique integers blacklist. Design an algorithm to pick a random integer in the range [0, n - 1] that is not in blacklist. Any integer tha…
原文链接: https://leetcode-cn.com/problems/prime-palindrome 英文原文Given an integer n, return the smallest prime palindrome greater than or equal to n. An integer is prime if it has exactly two divisors: 1 and itself. Note that 1 is not a prime number. For …
原文链接: https://leetcode-cn.com/problems/binary-gap 英文原文Given a positive integer n, find and return the longest distance between any two adjacent 1's in the binary representation of n. If there are no two adjacent 1's, return 0. Two 1's are adjacent if…
原文链接: https://leetcode-cn.com/problems/reordered-power-of-2 英文原文You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero. Return true if and only if we can do this so that t…
原文链接: https://leetcode-cn.com/problems/stone-game 英文原文Alice and Bob play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to…
原文链接: https://leetcode-cn.com/problems/nth-magical-number 英文原文A positive integer is magical if it is divisible by either a or b. Given the three integers n, a, and b, return the nth magical number. Since the answer may be very large, return it modulo…
原文链接: https://leetcode-cn.com/problems/random-pick-with-weight 英文原文You are given a 0-indexed array of positive integers w where w[i] describes the weight of the ith index. You need to implement the function pickIndex(), which randomly picks an index …
原文链接: https://leetcode-cn.com/problems/random-flip-matrix 英文原文There is an m x n binary grid matrix with all the values set 0 initially. Design an algorithm to randomly pick an index (i, j) where matrix[i][j] == 0 and flips it to 1. All the indices (i…
原文链接: https://leetcode-cn.com/problems/implement-rand10-using-rand7 英文原文Given the API rand7() that generates a uniform random integer in the range [1, 7], write a function rand10() that generates a uniform random integer in the range [1, 10]. You can…
原文链接: https://leetcode-cn.com/problems/random-point-in-non-overlapping-rectangles 英文原文You are given an array of non-overlapping axis-aligned rectangles rects where rects[i] = [ai, bi, xi, yi] indicates that (ai, bi) is the bottom-left corner point of…