
算法分析与设计课程作业
!&?
这个作者很懒,什么都没留下…
展开
-
算法——Week17
45. Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position....原创 2018-12-30 10:39:06 · 132 阅读 · 0 评论 -
算法——Week 1
1.Two Sum问题描述 Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you ma...原创 2018-09-09 09:49:23 · 168 阅读 · 0 评论 -
算法——Week 2
169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and th...原创 2018-09-14 10:03:53 · 151 阅读 · 0 评论 -
算法——Week3
22. Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[“((()))”,“(()())”,“(()...原创 2018-12-26 15:07:54 · 137 阅读 · 0 评论 -
算法——Week4
771. Jewels and StonesYou’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to k...原创 2018-12-27 08:56:35 · 141 阅读 · 0 评论 -
算法——Week5
938. Range Sum of BSTGiven the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).The binary search tree is guaranteed to have unique val...原创 2018-12-27 09:29:11 · 186 阅读 · 0 评论 -
算法——Week6
841.Keys and RoomsThere are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys to access the next room.Formally, each room i has a...原创 2018-10-14 11:43:00 · 155 阅读 · 0 评论 -
算法——Week 7
684.Redundant ConnectionIn this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, ...原创 2018-10-15 23:29:04 · 235 阅读 · 0 评论 -
算法——Week8
743. Network Delay TimeThere 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 ...原创 2018-12-26 09:47:54 · 243 阅读 · 0 评论 -
算法——Week9
687. Longest Univalue PathGiven a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.Note: The length of ...原创 2018-12-27 10:45:33 · 138 阅读 · 0 评论 -
算法——Week10
207. Course ScheduleThere are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is...原创 2018-12-27 18:25:18 · 172 阅读 · 0 评论 -
算法——Week11
210. Course Schedule IIThere are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which...原创 2018-12-28 08:34:38 · 168 阅读 · 0 评论 -
算法——Week12
104. Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: ...原创 2018-12-28 09:17:30 · 143 阅读 · 0 评论 -
算法——Week13
406. Queue Reconstruction by HeightSuppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is th...原创 2018-12-28 18:07:02 · 115 阅读 · 0 评论 -
算法——Week14
122. Best Time to Buy and Sell Stock IISay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many...原创 2018-12-29 09:08:01 · 144 阅读 · 0 评论 -
算法——Week15
134. Gas StationThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from s...原创 2018-12-29 10:02:09 · 201 阅读 · 0 评论 -
算法——Week16
55. Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Det...原创 2018-12-29 10:56:42 · 123 阅读 · 0 评论 -
算法——project
Capacitated Facility Location Problem问题描述Suppose there are n facilities and m customers. We wish to choose:(1) which of the n facilities to open(2) the assignment of customers to facilitiesThe o...原创 2018-12-21 12:18:53 · 299 阅读 · 1 评论