leetcode排序
文章平均质量分 59
Bryan要加油
这个作者很懒,什么都没留下…
展开
-
853. Car Fleet[单调栈]
ProblemThere are n cars going to the same destination along a one-lane road. The destination is target miles away.You are given two integer array position and speed, both of length n, where position[i] is the position of the ith car and speed[i] is the s原创 2021-12-15 20:49:04 · 836 阅读 · 0 评论 -
881. Boats to Save People[Medium](Leetcode每日一题-2021.08.26)
Problem原创 2021-09-01 20:23:47 · 264 阅读 · 0 评论 -
611. Valid Triangle Number[Medium](Leetcode每日一题-2021.08.04)
ProblemGiven 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.Constraints:1 <= nums.length <= 10000 <= nums[i] <= 1000Example1Input: nums =原创 2021-08-05 18:52:26 · 246 阅读 · 0 评论 -
581. Shortest Unsorted Continuous Subarray[Medium](Leetcode每日一题-2021.08.03)
ProblemGiven 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 ascending order.Return the shortest such subarray and output its length.Constrain原创 2021-08-03 19:08:19 · 215 阅读 · 0 评论 -
1337. The K Weakest Rows in a Matrix[Easy](Leetcode每日一题-2021.08.01)
ProblemYou are given an m x n binary matrix mat of 1’s (representing soldiers) and 0’s (representing civilians). The soldiers are positioned in front of the civilians. That is, all the 1’s will appear to the left of all the 0’s in each row.A row i is wea原创 2021-08-02 22:45:05 · 339 阅读 · 0 评论 -
987. Vertical Order Traversal of a Binary Tree[Hard](Leetcode每日一题-2021.07.31)
ProblemGiven the root of a binary tree, calculate the vertical order traversal of the binary tree.For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of t原创 2021-07-31 22:44:33 · 227 阅读 · 0 评论 -
1846. Maximum Element After Decreasing and Rearranging[Medium](Leetcode每日一题-2021.07.15)--抄答案
ProblemYou are given an array of positive integers arr. Perform some operations (possibly none) on arr so that it satisfies these conditions:The value of the first element in arr must be 1.The absolute difference between any 2 adjacent elements must be原创 2021-07-16 22:09:29 · 529 阅读 · 0 评论 -
274. H-Index[Medium](Leetcode每日一题-2021.07.11)--抄答案
ProblemGiven an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return compute the researcher’s h-index.According to the definition of h-index on Wikipedia: A scientist has an index h i原创 2021-07-12 21:35:35 · 135 阅读 · 0 评论 -
451. Sort Characters By Frequency[Medium](Leetcode每日一题-2021.07.03)
ProblemGiven a string s, sort it in decreasing order based on the frequency of characters, and return the sorted string.Constraints:1 <= s.length <= 5 * 105s consists of English letters and digits.Example1Input: s = “tree”Output: “eert”Exp原创 2021-07-03 21:10:13 · 227 阅读 · 0 评论 -
692. Top K Frequent Words[Medium](Leetcode每日一题-2021.05.20)
ProblemGiven 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 have the same frequency, then the word with the lower alphabetical order comes first.Note:You ma原创 2021-05-20 08:39:25 · 267 阅读 · 0 评论 -
179. Largest Number(Leetcode每日一题-2021.04.12)
ProblemGiven 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.Constraints:1 <= nums.length <= 1000 <= nums[i] &原创 2021-04-12 08:43:55 · 666 阅读 · 0 评论 -
976. Largest Perimeter Triangle(Leetcode每日一题-2020.11.29)
ProblemGiven an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths.If it is impossible to form any triangle of non-zero area, return 0.Note:3 <= A.length <= 100001 <= A[原创 2020-11-29 22:50:48 · 217 阅读 · 0 评论 -
164. Maximum Gap(Leetcode每日一题-2020.11.26)--抄答案
ProblemGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Return 0 if the array contains less than 2 elements.Note:You may assume all elements in the array are non-negative integers and fit in the 3原创 2020-11-26 19:34:03 · 171 阅读 · 0 评论 -
1370. Increasing Decreasing String(Leetcode每日一题-2020.11.25)
ProblemGiven a string s. You should re-order the string using the following algorithm:Pick the smallest character from s and append it to the result.Pick the smallest character from s which is greater than the last appended character to the result and原创 2020-11-25 20:15:17 · 168 阅读 · 0 评论 -
1030. Matrix Cells in Distance Order(Leetcode每日一题-2020.11.17)
ProblemWe are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0 <= r < R and 0 <= c < C.Additionally, we are given a cell in that matrix with coordinates (r0, c0).Return the coordinates of all cells原创 2020-11-17 20:57:52 · 145 阅读 · 0 评论 -
1122. Relative Sort Array(Leetcode每日一题-2020.11.14)
ProblemGiven two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that don’t appear in arr2 sh原创 2020-11-15 21:36:28 · 143 阅读 · 0 评论 -
973. K Closest Points to Origin(Leetcode每日一题-2020.11.09)
ProblemWe have a list of points on the plane. Find the K closest points to the origin (0, 0).(Here, the distance between two points on a plane is the Euclidean distance.)You may return the answer in any order. The answer is guaranteed to be unique (ex原创 2020-11-09 21:35:34 · 242 阅读 · 0 评论 -
56. Merge Intervals(Leetcode每日一题-2020.04.16)
占坑原创 2020-04-16 22:41:18 · 185 阅读 · 0 评论 -
912. Sort an Array(Leetcode每日一题-2020.03.31)
ProblemGiven an array of integers nums, sort the array in ascending order.Example1Input: nums = [5,2,3,1]Output: [1,2,3,5]Example2Input: nums = [5,1,1,2,0,0]Output: [0,0,1,1,2,5]SolutionS...原创 2020-03-31 20:43:38 · 215 阅读 · 0 评论 -
面试题 01.02. Check Permutation LCCI
ProblemGiven two strings,write a method to decide if one is a permutation of the other.Note:0 <= len(s1) <= 1000 <= len(s2) <= 100Example1Input: s1 = “abc”, s2 = “bca”Output: true...原创 2020-03-23 23:26:24 · 175 阅读 · 0 评论 -
面试题 01.01. Is Unique LCCI
ProblemImplement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?Example1Input: s = “leetcode”Output: falseExample2Input: s ...原创 2020-03-23 23:22:05 · 259 阅读 · 0 评论