![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hashtable
ForABiggerWorld
这个作者很懒,什么都没留下…
展开
-
1387. Sort Integers by The Power Value
The power of an integerxis defined as the number of steps needed to transformxinto1using the following steps:ifxis even thenx = x / 2 ifxis odd thenx = 3 * x + 1For example, the power ...原创 2020-03-24 21:17:27 · 577 阅读 · 0 评论 -
1371. Find the Longest Substring Containing Vowels in Even Counts
Given the strings, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times.Example 1:I...原创 2020-03-16 22:04:29 · 241 阅读 · 0 评论 -
1186. Maximum Subarray Sum with One Deletion
Given an array of integers, return the maximum sum for anon-emptysubarray (contiguous elements) with at most one element deletion.In other words, you want to choose a subarray and optionally delete...原创 2019-09-08 13:47:38 · 313 阅读 · 0 评论 -
1169. Invalid Transactions
A transaction ispossibly invalidif:the amount exceeds $1000, or; if it occurs within (and including) 60 minutes of another transaction with the same name in a different city.Each transaction str...原创 2019-08-25 13:57:21 · 537 阅读 · 0 评论 -
1124. Longest Well-Performing Interval
We are givenhours, a list of the number of hoursworked per day for a given employee.A day is considered to be atiring dayif and only if the number of hours worked is (strictly) greater than8....原创 2019-07-14 14:07:25 · 789 阅读 · 0 评论 -
918. Maximum Sum Circular Subarray
Given a circular array C of integers represented by A, find the maximum possible sum of a non-empty subarray of C.Here, a circular array means the end of the array connects to the beginning of the a...原创 2018-10-07 11:04:06 · 568 阅读 · 0 评论 -
519. Random Flip Matrix & 710. Random Pick with Blacklist
You are given the number of rows n_rows and number of columns n_cols of a 2D binary matrix where all values are initially 0. Write a function flip which chooses a 0 value uniformly at random, changes ...原创 2018-09-03 18:54:45 · 360 阅读 · 0 评论 -
403. Frog Jump
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.Given a list o...原创 2017-05-06 09:40:26 · 404 阅读 · 0 评论 -
895. Maximum Frequency Stack
Implement FreqStack, a class which simulates the operation of a stack-like data structure.FreqStack has two functions:push(int x), which pushes an integer x onto the stack. pop(), which removes a...原创 2018-08-27 10:30:52 · 333 阅读 · 0 评论 -
781. Rabbits in Forest
In 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 mi...原创 2018-08-16 15:25:43 · 147 阅读 · 0 评论 -
128. Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100, 4, 200, 1, 3, 2]Output: 4Ex...原创 2018-08-05 11:41:00 · 122 阅读 · 0 评论 -
873. Length of Longest Fibonacci Subsequence
A sequence X_1, X_2, ..., X_n is fibonacci-like if:n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= nGiven a strictly increasing array A of positive integers forming a sequence, find the leng...原创 2018-07-22 12:21:06 · 699 阅读 · 0 评论 -
149. Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.写的简洁还是需要功底的# Definition for a point.class Point: def __init__(self, a=0, b=0): s原创 2018-02-01 12:25:27 · 296 阅读 · 0 评论 -
347. Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number原创 2018-01-12 21:41:19 · 244 阅读 · 0 评论 -
676. Implement Magic Dictionary
Implement a magic directory with buildDict, and search methods.For the method buildDict, you'll be given a list of non-repetitive words to build a dictionary.For the method search, you'll be g原创 2017-09-10 11:04:04 · 910 阅读 · 0 评论