
Greedy Algorithm
文章平均质量分 82
flyatcmu
这个作者很懒,什么都没留下…
展开
-
Video Stitching
You are given a series of video clips from a sporting event that lastedtimeseconds. These video clips can be overlapping with each other and have varying lengths.Each video clip is described by an arrayclipswhereclips[i] = [starti, endi]indicates t...原创 2022-03-22 00:57:19 · 275 阅读 · 0 评论 -
Minimum Number of Taps to Open to Water a Garden
There is a one-dimensional garden on the x-axis. The garden starts at the point0and ends at the pointn. (i.e The length of the garden isn).There aren + 1taps located at points[0, 1, ..., n]in the garden.Given an integernand an integer arrayr...原创 2022-03-22 00:55:05 · 228 阅读 · 0 评论 -
Minimum Insertions to Balance a Parentheses String
Given a parentheses stringscontaining only the characters'('and')'. A parentheses string isbalancedif:Any left parenthesis'('must have a corresponding two consecutive right parenthesis'))'. Left parenthesis'('must go before the corresponding...原创 2022-02-12 07:01:17 · 205 阅读 · 0 评论 -
Best Time to Buy and Sell Stock I
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock)...原创 2016-10-16 02:25:06 · 230 阅读 · 0 评论 -
Minimum Number of Taps to Open to Water a Garden
There is a one-dimensional garden on the x-axis. The garden starts at the point0and ends at the pointn. (i.e The length of the garden isn).There aren + 1taps locatedat points[0, 1, ..., n]in the garden.Given an integernand an integer arrayr...原创 2020-06-22 13:16:36 · 175 阅读 · 0 评论 -
Minimum Number of Arrows to Burst Balloons
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordinates don't matter and hence the x-coordinates of start a原创 2020-05-27 11:41:50 · 111 阅读 · 0 评论 -
Split Array into Consecutive Subsequences
Given an arraynumssorted in ascending order, returntrueif and only if you can split it into 1 or more subsequences such that each subsequence consists of consecutive integersand has length at lea...原创 2020-04-15 02:41:02 · 171 阅读 · 0 评论 -
Binary Tree Cameras
Given a binary tree, we install cameras on the nodes of the tree.Each camera ata node can monitorits parent, itself, and its immediate children.Calculate the minimum number of cameras needed to...原创 2020-04-12 07:55:41 · 151 阅读 · 0 评论 -
Guess the Word
This problem is an*interactive problem*new to the LeetCode platform.We are given a word list of unique words, each word is 6 letters long, and one word in this list is chosen assecret.You may c...原创 2020-03-31 14:05:19 · 890 阅读 · 0 评论 -
Minimum SubArray
Given an array of integers, find the continuous subarray with smallest sum.Return the sum of the subarray.ExampleExample 1Input:[1, -1, -2, 1]Output:-3Example 2Input:[1, -1, -2, 1, -4]...原创 2019-10-21 12:53:30 · 124 阅读 · 0 评论 -
Jump Game II
Given 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.Your goal is to原创 2014-11-30 09:14:50 · 459 阅读 · 0 评论 -
Stock Maximize
Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next N days.Each day, you can either buy on原创 2016-09-04 13:41:24 · 377 阅读 · 0 评论