leetcode数学
文章平均质量分 52
Bryan要加油
这个作者很懒,什么都没留下…
展开
-
789. Escape The Ghosts[Medium](Leetcode每日一题-2021.08.22)
Problem曼哈顿距离原创 2021-08-24 22:03:11 · 166 阅读 · 0 评论 -
171. Excel Sheet Column Number[Easy](Leetcode每日一题-2021.07.30)
Problem原创 2021-07-31 22:41:37 · 169 阅读 · 0 评论 -
面试题 17.10. Find Majority Element LCCI[Easy](Leetcode每日一题-2021.07.09)
ProblemA majority element is an element that makes up more than half of the items in an array. Given a positive integers array, find the majority element. If there is no majority element, return -1. Do this in O(N) time and O(1) space.Example1Input: [1原创 2021-07-09 08:24:29 · 222 阅读 · 0 评论 -
168. Excel Sheet Column Title[Easy](Leetcode每日一题-2021.06.29)
ProblemGiven an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.Constraints:1 <= columnNumber <= 231 - 1Example1Input: columnNumber = 1Output: “A”Example2Input: columnNumber = 28Output: “AB”原创 2021-06-29 22:20:57 · 196 阅读 · 0 评论 -
149. Max Points on a Line[Hard](Leetcode每日一题-2021.06.24)
ProblemGiven an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line.Constraints:1 <= points.length <= 300points[i].length == 2-10^4 <= xi, yi原创 2021-06-24 08:43:46 · 570 阅读 · 0 评论 -
483. Smallest Good Base[Hard](Leetcode每日一题-2021.06.18)--抄答案
ProblemGiven 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.Constraints:n is an integer in the range [3, 10^18].n does not contain any leading zeros.Exa原创 2021-06-18 08:34:25 · 562 阅读 · 0 评论 -
65. Valid Number[Hard](Leetcode每日一题-2021.06.17)--抄答案
ProblemA valid number can be split up into these components (in order):A decimal number or an integer.(Optional) An ‘e’ or ‘E’, followed by an integer.A decimal number can be split up into these components (in order):(Optional) A sign character (ei原创 2021-06-17 08:24:46 · 177 阅读 · 0 评论 -
810. Chalkboard XOR Game[Hard](Leetcode每日一题-2021.05.22)--抄答案
ProblemWe are given non-negative integers nums[i] which are written on a chalkboard. Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first. If erasing a number causes the bitwise XOR of all the elements of th原创 2021-05-22 21:18:42 · 716 阅读 · 0 评论 -
12. Integer to Roman[Medium](Leetcode每日一题-2021.05.14)--抄答案
ProblemRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.For example, 2 is written as II in Roman numeral, just two one’s added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, wh原创 2021-05-14 21:55:34 · 660 阅读 · 0 评论 -
7. Reverse Integer(Leetcode每日一题-2021.05.03)
ProblemGiven a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2^31, 2^31 - 1], then return 0.Assume the environment does not allow you to store 64-bit integers (原创 2021-05-03 17:25:01 · 287 阅读 · 0 评论 -
633. Sum of Square Numbers(Leetcode每日一题-2021.04.28)
ProblemGiven a non-negative integer c, decide whether there’re two integers a and b such that a^2 + b^2 = c.Constraints:0 <= c <= 2^31 - 1Example1Input: c = 5Output: trueExplanation: 1 * 1 + 2 * 2 = 5Example2Input: c = 3Output: false原创 2021-04-28 08:14:23 · 161 阅读 · 0 评论 -
263. Ugly Number(Leetcode每日一题-2021.04.10)
ProblemGiven an integer n, return true if n is an ugly number.Ugly number is a positive number whose prime factors only include 2, 3, and/or 5.Constraints:-2^31 <= n <= 2^31 - 1Example1Input: n = 6Output: trueExplanation: 6 = 2 × 3Exampl原创 2021-04-10 09:20:01 · 736 阅读 · 0 评论 -
781. Rabbits in Forest(Leetcode每日一题-2021.04.04)--抄答案
ProblemIn a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Those answers are placed in an array.Return the minimum number of rabbits that could be in the fore原创 2021-04-04 11:50:57 · 408 阅读 · 0 评论 -
1006. Clumsy Factorial(Leetcode每日一题-2021.04.01)
ProblemNormally, 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 instead make a clumsy factorial: using the integers in decreas原创 2021-04-01 12:44:43 · 274 阅读 · 0 评论 -
628. Maximum Product of Three Numbers(Leetcode每日一题-2021.01.20)
ProblemGiven an integer array nums, find three numbers whose product is maximum and return the maximum product.Constraints:3 <= nums.length <= 10^4-1000 <= nums[i] <= 1000Example1Input: nums = [1,2,3]Output: 6Example2Input: nums =原创 2021-01-20 20:18:58 · 116 阅读 · 0 评论 -
1232. Check If It Is a Straight Line(Leetcode每日一题-2021.01.17)
ProblemYou are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.Constraints:2 <= coordinates.length <= 1000coordinates[i].length ==原创 2021-01-17 22:00:43 · 191 阅读 · 0 评论 -
1018. Binary Prefix Divisible By 5(Leetcode每日一题-2021.01.14)
ProblemGiven an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binary number (from most-significant-bit to least-significant-bit.)Return a list of booleans answer, where answer[i] is true if and only if N_i is di原创 2021-01-14 20:59:15 · 275 阅读 · 0 评论 -
399. Evaluate Division(Leetcode每日一题-2021.01.06)
ProblemYou are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that represents a single variable.You are als原创 2021-01-06 19:11:32 · 226 阅读 · 0 评论 -
509. Fibonacci Number(Leetcode每日一题-2021.01.04)
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,F(0) = 0, F(1) = 1F(n) = F(n - 1) + F(n - 2), for n > 1.Given n,原创 2021-01-04 20:49:49 · 195 阅读 · 0 评论 -
204. Count Primes(Leetcode每日一题-2020.12.03)
ProblemCount the number of prime numbers less than a non-negative number, n.Constraints:0 <= n <= 5 * 106Example1Input: n = 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.Example2Input: n = 0Output:原创 2020-12-03 20:54:58 · 154 阅读 · 0 评论 -
31. Next Permutation(Leetcode每日一题-2020.11.10)
ProblemImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such an arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order).The re原创 2020-11-10 20:52:25 · 159 阅读 · 0 评论 -
60. Permutation Sequence(Leetcode每日一题-2020.09.05)
ProblemThe set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order, we get the following sequence for n = 3:“123”“132”“213”“231”“312”“321”Given n and k, return the kth permutation sequenc原创 2020-09-06 17:26:23 · 169 阅读 · 0 评论 -
233. Number of Digit One && 剑指 Offer 43. 1~n整数中1出现的次数
ProblemGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.ExampleInput: 13Output: 6Explanation: Digit 1 occurred in the following numbers: 1, 10, 11, 12, 13.Solution统计每一位上1出现的次数。c原创 2020-08-17 22:14:36 · 132 阅读 · 0 评论 -
43. Multiply Strings(Leetcode每日一题-2020.08.13)
ProblemGiven two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.Note:The length of both num1 and num2 is < 110.Both num1 and num2 contain only digits 0-9.Both num1 and原创 2020-08-13 21:53:23 · 146 阅读 · 0 评论 -
415. Add Strings(Leetcode每日一题-2020.08.03)
ProblemGiven two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is < 5100.Both num1 and num2 contains only digits 0-9.Both num1 and num2 does not contain any leading原创 2020-08-04 22:32:35 · 200 阅读 · 0 评论 -
1025. Divisor Game(Leetcode每日一题-2020.07.24)
ProblemAlice and Bob take turns playing a game, with Alice starting first.Initially, there is a number N on the chalkboard. On each player’s turn, that player makes a move consisting of:Choosing any x with 0 < x < N and N % x == 0.Replacing the原创 2020-07-26 09:32:35 · 238 阅读 · 0 评论 -
9. Palindrome Number(Leetcode每日一题-2020.06.10)
ProblemDetermine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example1Input: 121Output: trueExample2Input: -121Output: falseExplanation: From left to right, it reads -121. From right t原创 2020-06-10 20:32:18 · 219 阅读 · 0 评论 -
50. Pow(x, n)(Leetcode每日一题-2020.05.11)
ProblemImplement pow(x, n), which calculates x raised to the power n.Example1Input: 2.00000, 10Output: 1024.00000Example2Input: 2.10000, 3Output: 9.26100Example3Input: 2.00000, -2Output: 0.25000Explanation: 2-2 = 1/22 = 1/4 = 0.25Solution原创 2020-05-11 22:26:17 · 200 阅读 · 0 评论 -
69. Sqrt(x)(Leetcode每日一题-2020.05.09)
ProblemImplement int sqrt(int x).Compute and return the square root of x, where x is guaranteed to be a non-negative integer.Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned.Examp原创 2020-05-10 09:41:50 · 313 阅读 · 0 评论 -
202. Happy Number(Leetcode每日一题-2020.04.30)
ProblemWrite an algorithm to determine if a number n is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the ...原创 2020-04-30 22:53:42 · 250 阅读 · 0 评论 -
面试题 16.03. Intersection LCCI(Leetcode每日一题-2020.04.12)
占位原创 2020-04-14 22:50:11 · 264 阅读 · 0 评论 -
面试题62. 圆圈中最后剩下的数字(Leetcode每日一题-2020.03.30)
Problem0,1,n-1这n个数字排成一个圆圈,从数字0开始,每次从这个圆圈里删除第m个数字。求出这个圆圈里剩下的最后一个数字。例如,0、1、2、3、4这5个数字组成一个圆圈,从数字0开始每次删除第3个数字,则删除的前4个数字依次是2、0、4、1,因此最后剩下的数字是3。Example1输入: n = 5, m = 3输出: 3Example2输入: n = 10, m =...原创 2020-03-30 20:13:22 · 344 阅读 · 0 评论 -
914. X of a Kind in a Deck of Cards(Leetcode每日一题-2020.03.27)
ProblemIn 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 groups of cards...原创 2020-03-27 20:57:16 · 227 阅读 · 0 评论 -
892. Surface Area of 3D Shapes(Leetcode每日一题-2020.03.25)
ProblemOn a N * N grid, we place some 1 * 1 * 1 cubes.Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j).Return the total surface area of the resulting shapes...原创 2020-03-25 20:20:24 · 316 阅读 · 0 评论 -
365. Water and Jug Problem(Leetcode每日一题-2020.03.21)
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two j...原创 2020-03-21 15:24:29 · 314 阅读 · 0 评论 -
836. Rectangle Overlap(Leetcode每日一题-2020.03.18)
ProblemA rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner.Two rectangles ov...原创 2020-03-18 19:47:45 · 181 阅读 · 0 评论 -
1103. Distribute Candies to People(Leetcode每日一题-2020.03.05)
ProblemWe distribute some number of candies, to a row of n = num_people people in the following way:We then give 1 candy to the first person, 2 candies to the second person, and so on until we give ...原创 2020-03-05 19:44:00 · 172 阅读 · 0 评论