
数据结构
景行cmy
这个作者很懒,什么都没留下…
展开
-
leetcode 41. First Missing Positive
Given an unsorted integer array, find the smallest missingpositive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1] Output: 2 Example 3: Input: [7,8,9,11,12] Outpu...转载 2019-07-15 10:25:35 · 88 阅读 · 0 评论 -
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 715. Range Module
A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRange(int left, int right)Adds the half-open int...原创 2019-08-05 13:50:01 · 166 阅读 · 0 评论 -
leetcode 239. Sliding Window Maximum
Given an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time the sliding window m...原创 2019-07-28 09:59:45 · 151 阅读 · 0 评论 -
leetcode 295. Find Median from Data Stream
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. For example, [2,3,4], the median ...原创 2019-07-28 10:56:00 · 92 阅读 · 0 评论 -
leetcode 460. LFU Cache
设计并实现最不经常使用(LFU)缓存的数据结构。它应该支持以下操作:get和put。 get(key)- 如果键存在于缓存中,则获取键的值(总是正数),否则返回 -1。 put(key, value)- 如果键不存在,请设置或插入值。当缓存达到其容量时,它应该在插入新项目之前,使最不经常使用的项目无效。在此问题中,当存在平局(即两个或更多个键具有相同使用频率)时,最近最少使用的键将被去除...原创 2019-08-15 13:04:27 · 169 阅读 · 0 评论