[LeetCode]743. Network Delay Time

原题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 is the target node, and w is the time it takes for a signal to travel from source to target.Now, we send a signal from a certain node K. How long will it take for all nodes to receive the signal? If it is impossible, return -1.NoteN will be in the ... Read More

LeetCode OJ Algorithm – Sliding Window Maximum(hard)

原题Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.For exampleGiven nums = [1,3,-1,-3,5,3,6,7], and k = 3.Window position Ma--------------- ----[1 3 -1] -3 5 3 6 7 1 [3 -1 -3]... Read More