摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example 阅读全文
posted @ 2018-03-06 16:01 轻风舞动 阅读(2735) 评论(0) 推荐(0) 编辑
摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: 与21. Merge Two Sorted Lists的拓展,这道题要合并k个有序链 阅读全文
posted @ 2018-03-06 10:29 轻风舞动 阅读(1379) 评论(0) 推荐(0) 编辑
摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the 阅读全文
posted @ 2018-03-06 08:36 轻风舞动 阅读(671) 评论(0) 推荐(0) 编辑
摘要: Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. Example: 380. Insert Delete 阅读全文
posted @ 2018-03-06 07:10 轻风舞动 阅读(355) 评论(0) 推荐(0) 编辑
摘要: Design a data structure that supports all following operations in average O(1) time. Example: 设计一个数据结构在O(1)时间内完成:insert(val),remove(val),getRandom() 由 阅读全文
posted @ 2018-03-06 07:03 轻风舞动 阅读(927) 评论(0) 推荐(0) 编辑
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2018-03-06 04:42 轻风舞动 阅读(488) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals. Example 1: Example 2: 给定一个有重叠的区间集合,合并所有重叠的区间。先对区间以第一个元素进行排序,定义一个变量result记录合并后的区间。然后迭 阅读全文
posted @ 2018-03-06 04:39 轻风舞动 阅读(608) 评论(0) 推荐(0) 编辑
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2018-03-06 02:47 轻风舞动 阅读(2430) 评论(0) 推荐(0) 编辑