原文链接: https://leetcode-cn.com/problems/number-of-boomerangs 英文原文You are given n points in the plane that are all distinct, where points[i] = [xi, yi]. A boomerang is a tuple of points (i, j, k) such that the distance between i and j equals the distan…
标签详情
数学 分类
原文链接: https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements 英文原文Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment n - 1 elements of the…
原文链接: 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/minimum-moves-to-equal-array-elements-ii 英文原文Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment or decrement an el…
原文链接: https://leetcode-cn.com/problems/can-i-win 英文原文In the "100 game" two players take turns adding, to a running total, any integer from 1 to 10. The player who first causes the running total to reach or exceed 100 wins. What if we change the game …
原文链接: https://leetcode-cn.com/problems/total-hamming-distance 英文原文The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given an integer array nums, return the sum of Hamming distances bet…
原文链接: https://leetcode-cn.com/problems/largest-palindrome-product 英文原文Given an integer n, return the largest palindromic integer that can be represented as the product of two n-digits integers. Since the answer can be very large, return it modulo 133…
原文链接: https://leetcode-cn.com/problems/smallest-good-base 英文原文Given an integer n represented as a string, return the smallest good base of n. We call k >= 2 a good base of n, if all digits of n base k are 1's. Example 1: Input: n = "13" Output: "3" E…
原文链接: https://leetcode-cn.com/problems/predict-the-winner 英文原文You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with player 1 starting first. Both players sta…
原文链接: 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/construct-the-rectangle 英文原文A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose lengt…
原文链接: https://leetcode-cn.com/problems/base-7 英文原文Given an integer num, return a string of its base 7 representation. Example 1: Input: num = 100 Output: "202" Example 2: Input: num = -7 Output: "-10" Constraints: -107 <= num <= 107 中文题目给定一个整数 num,将其…
原文链接: https://leetcode-cn.com/problems/perfect-number 英文原文A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly. Given a…
原文链接: https://leetcode-cn.com/problems/continuous-subarray-sum 英文原文Given an integer array nums and an integer k, return true if nums has a continuous subarray of size at least two whose elements sum up to a multiple of k, or false otherwise. An integ…
原文链接: https://leetcode-cn.com/problems/complex-number-multiplication 英文原文A complex number can be represented as a string on the form "real+imaginaryi" where: real is the real part and is an integer in the range [-100, 100]. imaginary is the imaginary…
原文链接: https://leetcode-cn.com/problems/minimum-time-difference 英文原文Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in the list. Example 1: Input: timePoints = ["23:59","00…
原文链接: https://leetcode-cn.com/problems/optimal-division 英文原文You are given an integer array nums. The adjacent integers in nums will perform the float division. For example, for nums = [2,3,4], we will evaluate the expression "2/3/4". However, you can…
原文链接: https://leetcode-cn.com/problems/next-greater-element-iii 英文原文Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, …
原文链接: https://leetcode-cn.com/problems/find-the-closest-palindrome 英文原文Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one. The closest is defin…
原文链接: https://leetcode-cn.com/problems/erect-the-fence 英文原文You are given an array trees where trees[i] = [xi, yi] represents the location of a tree in the garden. You are asked to fence the entire garden using the minimum length of rope as it is expe…
原文链接: https://leetcode-cn.com/problems/valid-square 英文原文Given the coordinates of four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square. The coordinate of a point pi is represented as [xi, yi]. The input is not g…
原文链接: https://leetcode-cn.com/problems/range-addition-ii 英文原文You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [ai, bi] means M[x][y] should be incremented by one for all 0 <= x < ai and 0 <= y < …
原文链接: https://leetcode-cn.com/problems/maximum-product-of-three-numbers 英文原文Given an integer array nums, find three numbers whose product is maximum and return the maximum product. Example 1: Input: nums = [1,2,3] Output: 6 Example 2: Input: nums = […
原文链接: https://leetcode-cn.com/problems/sum-of-square-numbers 英文原文Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Input: c = 5 Output: true Explanation: 1 * 1 + 2 * 2 = 5 Example 2: Input:…
原文链接: https://leetcode-cn.com/problems/solve-the-equation 英文原文Solve a given equation and return the value of 'x' in the form of a string "x=#value". The equation contains only '+', '-' operation, the variable 'x' and its coefficient. You should retur…
原文链接: https://leetcode-cn.com/problems/2-keys-keyboard 英文原文There is only one character 'A' on the screen of a notepad. You can perform two operations on this notepad for each step: Copy All: You can copy all the characters present on the screen (a pa…
原文链接: https://leetcode-cn.com/problems/beautiful-arrangement-ii 英文原文Given two integers n and k, construct a list answer that contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is answer =…
原文链接: https://leetcode-cn.com/problems/maximum-swap 英文原文You are given an integer num. You can swap two digits at most once to get the maximum valued number. Return the maximum valued number you can get. Example 1: Input: num = 2736 Output: 7236 Expla…
原文链接: https://leetcode-cn.com/problems/bulb-switcher-ii 英文原文There is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall. Each of the four buttons has a different functionality where: Button 1: Flips…
原文链接: https://leetcode-cn.com/problems/24-game 英文原文You are given an integer array cards of length 4. You have four cards, each containing a number in the range [1, 9]. You should arrange the numbers on these cards in a mathematical expression using t…