LeetCode - Kth Largest Element in a Stream
摘要:
遍历数组时将数字加入优先队列(堆),一旦堆的大小大于k就将堆顶元素去除,确保堆的大小为k。遍历完后堆顶就是返回值。 阅读全文
posted @ 2018-09-23 23:46 IncredibleThings 阅读(92) 评论(0) 推荐(0) 编辑
2018年9月23日 #
posted @ 2018-09-23 23:46 IncredibleThings 阅读(92) 评论(0) 推荐(0) 编辑
posted @ 2018-09-23 21:05 IncredibleThings 阅读(136) 评论(0) 推荐(0) 编辑
posted @ 2018-09-23 08:21 IncredibleThings 阅读(93) 评论(0) 推荐(0) 编辑
posted @ 2018-09-23 08:06 IncredibleThings 阅读(115) 评论(0) 推荐(0) 编辑
posted @ 2018-09-23 06:02 IncredibleThings 阅读(115) 评论(0) 推荐(0) 编辑