Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, th…
分类:LeetCode题目解答汇总
LeetCode | Unique Paths(唯一路径)
A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in t…
LeetCode | Median of Two Sorted Arrays(两个数组的中位数)
题目: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays…
LeetCode | Candy(分糖果问题)
There are N children standing in a line. Each child is assigned a rating value. You are giving candi…
LeetCode | Path Sum(路径和)
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the value…
LeetCode | Valid Parentheses(括号匹配)
Given a string containing just the characters '(', ')', '{', '}', '[' and '…
LeetCode | Search for a Range(查找数据出现的范围)
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorith…
LeetCode | Sort Colors(荷兰国旗问题)
Given an array with n objects colored red, white or blue, sort them so that objects of the same colo…
LeetCode | Unique Binary Search Trees II(构建二叉搜索树)
Given n, generate all structurally unique BST’s (binary search trees) that store values 1…
LeetCode | Remove Element(删除指定元素)
Given an array and a value, remove all instances of that value in place and return the new length. The order o…
LeetCode | Reverse Integer(翻转整数)
题目: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click…
LeetCode | Recover Binary Search Tree(恢复二叉搜索树)
wo elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its struct…