![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Math
weixin_39145266
这个作者很懒,什么都没留下…
展开
-
1218 Longest Arithmetic Subsequence of Given Difference
1 题目 Given an integer arrayarrand an integerdifference, return the length of the longest subsequence inarrwhich is an arithmetic sequence such that the difference between adjacent elements in th...原创 2019-12-24 06:21:58 · 105 阅读 · 0 评论 -
1104 Path In Zigzag Labelled Binary Tree
1 题目 In an infinite binary tree where every node has two children, the nodes are labelled in row order. In the odd numbered rows (ie., the first, third, fifth,...), the labelling is left to right, w...原创 2019-11-26 14:33:59 · 88 阅读 · 0 评论 -
319 Bulb Switcher
1 题目 There arenbulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turnin...原创 2019-06-26 17:26:58 · 59 阅读 · 0 评论 -
357 Count Numbers with Unique Digits
1 题目 Given anon-negativeinteger n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Input: 2 Output: 91 Explanation: The answer should be the total numbers in the range o...原创 2019-07-07 21:07:04 · 56 阅读 · 0 评论 -
462 Minimum Moves to Equal Array Elements II
1 题目 Given anon-emptyinteger array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected eleme...原创 2019-07-13 10:47:02 · 58 阅读 · 0 评论 -
368 Largest Divisible Subset
1 题目 Given a set ofdistinctpositive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si% Sj= 0 or Sj% Si= 0. If there are multiple solutio...原创 2019-07-10 15:05:12 · 94 阅读 · 0 评论 -
397 Integer Replacement
1 题目 Given a positive integernand you can do operations as follow: Ifnis even, replacenwithn/2. Ifnis odd, you can replacenwith eithern+ 1orn- 1. What is the minimum number of repla...原创 2019-07-10 22:42:57 · 42 阅读 · 0 评论 -
343 Integer Break
1 题目 Given a positive integern, break it into the sum ofat leasttwo positive integers and maximize the product of those integers. Return the maximum product you can get. Example 1: Input: 2 Out...原创 2019-07-07 15:15:09 · 55 阅读 · 0 评论 -
413 Arithmetic Slices
1 题目 A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic seq...原创 2019-07-12 15:29:58 · 118 阅读 · 0 评论 -
1025 Divisor Game
1 题目 Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a numberNon the chalkboard. On each player's turn, that player makes amoveconsisting of: Choosinga...原创 2019-08-03 12:00:38 · 121 阅读 · 0 评论 -
313 Super Ugly Number
1 题目 Write a program to find thenthsuper ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime listprimesof sizek. Example: Input: n = 12, prime...原创 2019-05-07 17:51:53 · 64 阅读 · 0 评论 -
400 Nth Digit
1题目 Find thenthdigit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:nis positive and will fit within the range of a 32-bit signed integer (n< 231). Example 1: ...原创 2019-05-08 15:14:00 · 81 阅读 · 0 评论 -
223 Rectangle Area
1 题目 Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Example: Input: A...原创 2019-04-23 17:10:57 · 83 阅读 · 0 评论 -
12 Integer to Roman
1 题目 Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM. Symbol Value I 1 V 5 X 10 L 50 C 100 D ...原创 2019-03-29 09:16:25 · 42 阅读 · 0 评论 -
29 Divide Two Integers
1 题目 Given two integersdividendanddivisor, divide two integers without using multiplication, division and mod operator. Return the quotient after dividingdividendbydivisor. The integer divisi...原创 2019-03-29 09:18:55 · 112 阅读 · 0 评论 -
279 Perfect Squares
1 题目 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. E...原创 2019-04-08 15:47:35 · 86 阅读 · 0 评论 -
264 Ugly Number II
1 题目 Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Input: n = 10 Output: 12 Explanation: 1, 2, 3, 4, 5, 6, 8,...原创 2019-04-11 21:47:42 · 68 阅读 · 0 评论 -
166 Fraction to Recurring Decimal
1 题目 Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating part in parentheses...原创 2019-04-03 10:22:03 · 168 阅读 · 0 评论 -
43 Multiply Strings
1 题目 Given two non-negative integersnum1andnum2represented as strings, return the product ofnum1andnum2, also represented as a string. Example 1: Input: num1 = "2", num2 = "3" Output: "6" ...原创 2019-04-03 10:40:42 · 64 阅读 · 0 评论 -
60 Permutation Sequence
1 题目 The set[1,2,3,...,n]contains a total ofn! unique permutations. By listing and labeling all of the permutations in order, we get the following sequence forn= 3: "123" "132" "213" "231" ...原创 2019-04-03 11:27:17 · 69 阅读 · 0 评论 -
50 Pow(x, n)
Implementpow(x,n), which calculatesxraised to the powern(xn). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: 9.26100 Example 3: Input: 2.00000, ...原创 2019-04-03 12:42:13 · 70 阅读 · 0 评论 -
204 Count Primes
1 题目 Count the number of prime numbers less than a non-negative number,n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. 2 尝试解 2.1 分析 从2...原创 2019-04-26 17:46:15 · 81 阅读 · 0 评论 -
8 String to Integer (atoi)
1 题目 Implementatoiwhichconverts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting fr...原创 2019-03-29 09:16:08 · 57 阅读 · 0 评论