原创 【LeetCode 945】 Minimum Increment to Make Array Unique

題目描述 Given an array of integers A, a move consists of choosing any A[i], and incrementing it by 1. Return the least

原创 【LeetCode 283】Move Zeroes

題目描述 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of

原创 【LeetCode 33】 Search in Rotated Sorted Array

題目描述 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4

原创 【LeetCode 983】 Minimum Cost For Tickets

題目描述 In a country popular for train travel, you have planned some train travelling one year in advance. The days o

原创 【LeetCode 236】 Lowest Common Ancestor of a Binary Tree

題目描述 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the de

原创 【LeetCode 687】Longest Univalue Path

題目描述 Given a binary tree, find the length of the longest path where each node in the path has the same value. This

原创 【LeetCode 114】 Flatten Binary Tree to Linked List

題目描述 Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: 1 / \

原创 【LeetCode 35】 Search Insert Position

題目描述 Given a sorted array and a target value, return the index if the target is found. If not, return the index whe

原创 【LeetCode 315】 Count of Smaller Numbers After Self

題目描述 You are given an integer array nums and you have to return a new counts array. The counts array has the proper

原创 【LeetCode 113】 Path Sum II

題目描述 Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. Note: A

原创 【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 ta

原创 【LeetCode 295】Find Median from Data Stream

題目描述 Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle val

原创 【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: Inpu

原创 【LeetCode 224】Basic Calculator

題目描述 Implement a basic calculator to evaluate a simple expression string. The expression string may contain open (

原创 【LeetCode 86】Partition List

題目描述 Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than