
LeetCode
Leetcode刷题专栏
Why not?
这个作者很懒,什么都没留下…
展开
-
LeetCode 31. Next Permutation
LeetCode 31. Next PermutationImplement next permutation, which rearranges numbers into thelexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as thelowest possible order (ie, sorted in ascend原创 2020-07-08 15:28:42 · 112 阅读 · 0 评论 -
LeetCode 1248. Count Number of Nice Subarrays
LeetCode 1248. Count Number of Nice SubarraysGiven an array of integers nums and an integer k. A subarray is called nice if there are k odd numbers on it.Return the number of nice sub-arrays.Examp...原创 2019-11-04 02:56:03 · 700 阅读 · 0 评论 -
Leetcode 1235. Maximum Profit in Job Scheduling(Hard)
We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].You’re given the startTime , endTime and profit arrays, you need to output th...原创 2019-10-21 03:15:15 · 327 阅读 · 0 评论 -
LeetCode 1223. Dice Roll Simulation(dp+记忆化搜索)
LeetCode 1223. Dice Roll SimulationA die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number i more than r...原创 2019-10-14 00:25:22 · 870 阅读 · 0 评论 -
LeetCode 76. Minimum Window Substring(Hard)
LeetCode 76. Minimum Window Substring(Hard)Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Example:Input: S = “ADOBECODE...原创 2019-10-11 10:18:10 · 202 阅读 · 0 评论 -
LeetCode 206. Reverse Linked List
LeetCode 206. Reverse Linked ListReverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be reversed ...原创 2019-10-11 05:28:25 · 116 阅读 · 0 评论 -
LeetCode 23. Merge k Sorted Lists
LeetCode 23. Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[1->4->5,1->3->4,2->6]Output: ...原创 2019-10-11 01:10:01 · 126 阅读 · 0 评论 -
LeetCode 42. Trapping Rain Water(Hard)
LeetCode 42. Trapping Rain WaterGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above el...原创 2019-10-10 13:54:50 · 126 阅读 · 0 评论 -
Leetcode 15 3sum
Leetcode 15 3sumTwo-Pointer O(n^2)Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.N...原创 2019-10-09 06:46:10 · 107 阅读 · 0 评论 -
Leetcode146 LRU Cache
Leetcode146 LRU CacheDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.get(key) - Get the value (will always be posi...原创 2019-10-08 23:15:44 · 113 阅读 · 0 评论