
哈希表
景行cmy
这个作者很懒,什么都没留下…
展开
-
leetcode 381. Insert Delete GetRandom O(1) - Duplicates allowed
Design a data structure that supports all following operations inaverageO(1)time.Note: Duplicate elements are allowed.insert(val): Inserts an item val to the collection. remove(val): Remove...原创 2019-07-15 16:34:53 · 108 阅读 · 0 评论 -
leetcode 30. Substring with Concatenation of All Words
You are given a string,s, and a list of words,words, that are all of the same length. Find all starting indices of substring(s) insthat is a concatenation of each word inwordsexactly once and wi...原创 2019-07-18 10:20:33 · 84 阅读 · 0 评论 -
leetcode 336. Palindrome Pairs
Given a list ofuniquewords, find all pairs ofdistinctindices(i, j)in the given list, so that the concatenation of the two words, i.e.words[i] + words[j]is a palindrome.Example 1:Input: ["...原创 2019-07-19 17:15:52 · 141 阅读 · 0 评论 -
leetcode 632. Smallest Range
You haveklists of sorted integers in ascending order. Find thesmallestrange that includes at least one number from each of theklists.We define the range [a,b] is smaller than range [c,d] ifb-...原创 2019-07-19 17:20:55 · 136 阅读 · 0 评论 -
leetcode 432. All O`one Data Structure
Implement a data structure supporting the following operations:Inc(Key) - Inserts a new keywith value 1. Or increments an existing key by 1. Key is guaranteed to be anon-emptystring. Dec(Key)...原创 2019-08-08 11:01:11 · 115 阅读 · 0 评论 -
leetcode 736. Parse Lisp Expression
You are given a stringexpressionrepresenting a Lisp-like expression to return the integer value of.The syntax for these expressions is given as follows.An expression is either an integer, a le...原创 2019-08-19 15:46:19 · 194 阅读 · 0 评论 -
leetcode 446. Arithmetic Slices II - Subsequence
A sequence of numbers 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 sequence...原创 2019-08-14 20:02:32 · 141 阅读 · 0 评论 -
leetcode 460. LFU Cache
设计并实现最不经常使用(LFU)缓存的数据结构。它应该支持以下操作:get和put。get(key)- 如果键存在于缓存中,则获取键的值(总是正数),否则返回 -1。put(key, value)- 如果键不存在,请设置或插入值。当缓存达到其容量时,它应该在插入新项目之前,使最不经常使用的项目无效。在此问题中,当存在平局(即两个或更多个键具有相同使用频率)时,最近最少使用的键将被去除...原创 2019-08-15 13:04:27 · 169 阅读 · 0 评论 -
leetcode 1036. Escape a Large Maze
In a 1 million by 1 million grid, the coordinates of each grid square are(x, y)with0 <= x, y < 10^6.We start at thesourcesquare and want to reach thetargetsquare. Each move, we can wal...原创 2019-09-21 17:01:12 · 226 阅读 · 0 评论