![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode 每日刷题
文章平均质量分 51
去糖冰美式
这个作者很懒,什么都没留下…
展开
-
LeetCode 55. Jump Game&&LeetCode 45. 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.Determine if you ...原创 2020-01-22 18:33:53 · 127 阅读 · 0 评论 -
LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, givenpreorder = [3,9,20,15,7]inorder = [9,3,15,...原创 2019-12-10 22:28:30 · 104 阅读 · 0 评论 -
LeetCode 101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric:1/ 2 2/ \ / 3 4 4 3But the followin...原创 2019-12-10 22:25:19 · 95 阅读 · 0 评论 -
LeetCode 145. Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes’ values.Example:Input: [1,null,2,3]12/3Output: [3,2,1]Follow up: Recursive solution is trivial, could you do it iteratively?给...原创 2019-12-09 20:12:27 · 67 阅读 · 0 评论 -
LeetCode 104. Maximum Depth of Binary Tree
Given 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: A leaf is a node with no children....原创 2019-12-09 20:11:09 · 142 阅读 · 0 评论 -
LeetCode 456. 132 Pattern
Given a sequence of n integers a1, a2, …, an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai < ak < aj. Design an algorithm that takes a list of n numbers as input an...原创 2019-12-08 16:58:42 · 81 阅读 · 0 评论 -
LeetCode 239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window m...原创 2019-12-07 17:32:06 · 70 阅读 · 0 评论 -
LeetCode 475. Heaters
Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now, you are given positions of houses and heaters on a horizontal lin...原创 2019-12-07 17:25:37 · 85 阅读 · 0 评论 -
AcWing 42. Trapping Rain Water
Given 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 elevation map is represented by array ...原创 2019-12-06 22:27:48 · 67 阅读 · 0 评论 -
LeetCode 42. Trapping Rain Water
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums2.T...原创 2019-12-06 22:23:41 · 74 阅读 · 0 评论 -
LeetCode 155. Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the ...原创 2019-12-05 23:01:07 · 64 阅读 · 0 评论 -
LeetCode 162. Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.The array may contain multiple peaks, i...原创 2019-12-05 22:58:46 · 77 阅读 · 0 评论 -
LeetCode 240. Search a 2D Matrix II
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in each c...原创 2019-12-04 21:08:04 · 69 阅读 · 0 评论 -
LeetCode 74. Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each row i...原创 2019-12-03 20:48:08 · 67 阅读 · 0 评论 -
LeetCode 148. Sort List
Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output: -1->0-&...原创 2019-12-03 20:06:53 · 71 阅读 · 0 评论 -
LeetCode 142. Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-in...原创 2019-12-02 17:00:31 · 68 阅读 · 0 评论 -
LeetCode 147. Insertion Sort List
Sort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.With each iteration one element ...原创 2019-12-01 21:29:12 · 74 阅读 · 0 评论 -
LeetCode 34. Find First and Last Position of Element in Sorted Array
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the t...原创 2019-12-01 13:01:51 · 80 阅读 · 0 评论 -
LeetCode 160. Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to intersect at node c1.Example 1:Input: intersectV...原创 2019-11-30 23:09:04 · 74 阅读 · 0 评论 -
LeetCode 21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->...原创 2019-11-30 23:03:57 · 63 阅读 · 0 评论 -
LeetCode 143. Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list’s nodes, only nodes itself may be changed.Example 1:Given 1->2->...原创 2019-11-29 23:21:26 · 67 阅读 · 0 评论 -
LeetCode 61. Rotate List
Given a linked list, rotate the list to the right by k places, where k is non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3->NULLExplanati...原创 2019-11-29 23:18:03 · 61 阅读 · 0 评论 -
LeetCode 92. Reverse Linked List II
Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3->2->5->...原创 2019-11-28 22:41:44 · 61 阅读 · 0 评论 -
LeetCode 206. Reverse Linked List
Reverse 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 either iteratively or recursively. ...原创 2019-11-28 22:02:17 · 56 阅读 · 0 评论 -
LeetCode 111. Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Note: A leaf is a node with no children....原创 2019-11-27 22:31:37 · 75 阅读 · 0 评论 -
LeetCode 83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.Example 1:Input: 1->1->2Output: 1->2Example 2:Input: 1->1->2->3->3Output: 1->2-&...原创 2019-11-27 20:06:41 · 57 阅读 · 0 评论 -
LeetCode 19. Remove Nth Node From End of List
Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the l...原创 2019-11-27 20:02:58 · 100 阅读 · 0 评论