随笔分类 - Heap
摘要:Starting with an undirected graph (the "original graph") with nodes from 0 to N-1, subdivisions are made to some of the edges. The graph is given as f
阅读全文
摘要:A car travels from a starting position to a destination which is target miles east of the starting position. Along the way, there are gas stations. Ea
阅读全文
摘要:There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i]. Now we want to hire exactly K workers to form a paid gro
阅读全文
摘要:There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v
阅读全文
摘要:Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words h
阅读全文
摘要:Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects
阅读全文
摘要:Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to
阅读全文
摘要:You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from th
阅读全文
摘要: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
阅读全文
摘要:A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are give
阅读全文