Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is de…
分类:LeetCode题目解答汇总
LeetCode | Single Number II(单个数字II)
Given an array of integers, every element appears three times except for one. Find that single one. …
LeetCode | Merge Intervals(合并区间间隔)
Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[…
LeetCode | Longest Valid Parentheses(最长有效的括号匹配)
Given a string containing just the characters '(' and ')', find the length of the longest valid…
LeetCode | Remove Duplicates from Sorted Array(删除有序数组的重复元素)
Given a sorted array, remove the duplicates in place such that each element appear only once and ret…
LeetCode | Convert Sorted Array to Binary Search Tree(有序数组转换成平衡二叉树搜索树)
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目解析: 给定一个有序…
LeetCode | Gray Code(格雷码)
The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negat…
LeetCode | Next Permutation(下一个排列)
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of nu…
LeetCode | 3Sum Closest(找到三个数使其和与target最接近)
Given an array S of n integers, find three integers in S such that the sum is cl…
LeetCode | 3Sum(三个数的和等于0)
Given an array S of n integers, are there elements a, b, c in S&n…
LeetCode | Best Time to Buy and Sell Stock(股票购买和抛售问题)
Say you have an array for which the ith element is the price of a given stock on day i. If you …
LeetCode | Unique Paths II(唯一路径II)
Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many uniq…