原文链接: https://leetcode-cn.com/problems/container-with-most-water 英文原文Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, a…
标签详情
贪心 分类
原文链接: https://leetcode-cn.com/problems/wildcard-matching 英文原文Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where: '?' Matches any single character. '*' Matches any sequence of characters…
原文链接: https://leetcode-cn.com/problems/jump-game-ii 英文原文Given an array of non-negative integers nums, 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 g…
原文链接: https://leetcode-cn.com/problems/jump-game 英文原文You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Return true if you …
原文链接: https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii 英文原文You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only h…
原文链接: https://leetcode-cn.com/problems/gas-station 英文原文There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith…
原文链接: https://leetcode-cn.com/problems/candy 英文原文There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: Each…
原文链接: https://leetcode-cn.com/problems/largest-number 英文原文Given a list of non-negative integers nums, arrange them such that they form the largest number. Note: The result may be very large, so you need to return a string instead of an integer. Examp…
原文链接: https://leetcode-cn.com/problems/remove-duplicate-letters 英文原文Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible…
原文链接: https://leetcode-cn.com/problems/create-maximum-number 英文原文You are given two integer arrays nums1 and nums2 of lengths m and n respectively. nums1 and nums2 represent the digits of two numbers. You are also given an integer k. Create the maximu…
原文链接: https://leetcode-cn.com/problems/patching-array 英文原文Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array. R…
原文链接: https://leetcode-cn.com/problems/increasing-triplet-subsequence 英文原文Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exists, return fa…
原文链接: https://leetcode-cn.com/problems/wiggle-subsequence 英文原文A wiggle sequence is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positi…
原文链接: https://leetcode-cn.com/problems/integer-replacement 英文原文Given a positive integer n, you can apply one of the following operations: If n is even, replace n with n / 2. If n is odd, replace n with either n + 1 or n - 1. Return the minimum number…
原文链接: https://leetcode-cn.com/problems/remove-k-digits 英文原文Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num. Example 1: Input: num = "1432219", k = 3 Out…
原文链接: https://leetcode-cn.com/problems/queue-reconstruction-by-height 英文原文You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents the ith person of …
原文链接: https://leetcode-cn.com/problems/longest-palindrome 英文原文Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example…
原文链接: https://leetcode-cn.com/problems/split-array-largest-sum 英文原文Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest…
原文链接: https://leetcode-cn.com/problems/strong-password-checker 英文原文A password is considered strong if the below conditions are all met: It has at least 6 characters and at most 20 characters. It contains at least one lowercase letter, at least one up…
原文链接: https://leetcode-cn.com/problems/non-overlapping-intervals 英文原文Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlappin…
原文链接: https://leetcode-cn.com/problems/assign-cookies 英文原文Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g[i], which is the minimum siz…
原文链接: https://leetcode-cn.com/problems/ipo 英文原文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 to increase its capital before the IPO. Since it has…
原文链接: https://leetcode-cn.com/problems/super-washing-machines 英文原文You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty. For each move, you could choose any m (1 <= m <= n) washing machines, and pas…
原文链接: https://leetcode-cn.com/problems/array-partition-i 英文原文Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized…
原文链接: https://leetcode-cn.com/problems/shortest-unsorted-continuous-subarray 英文原文Given an integer array nums, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in asce…
原文链接: https://leetcode-cn.com/problems/can-place-flowers 英文原文You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0's and…
原文链接: https://leetcode-cn.com/problems/valid-triangle-number 英文原文Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: nums = [2,2,3,4…
原文链接: https://leetcode-cn.com/problems/task-scheduler 英文原文Given a characters array tasks, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time…
原文链接: https://leetcode-cn.com/problems/course-schedule-iii 英文原文There are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [durationi, lastDayi] indicate that the ith course should be taken continuousl…
原文链接: https://leetcode-cn.com/problems/smallest-range-covering-elements-from-k-lists 英文原文You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists. We define the ra…
1 / 6