Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numb…
分类:LeetCode题目解答汇总
LeetCode | Merge Sorted Array(归并有序数组)
Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has e…
LeetCode | Largest Rectangle in Histogram(直方图围城的最大矩形面积)
Given n non-negative integers representing the histogram’s bar height where the width of each …
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 | Reverse Linked List II(翻转链表2)
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given&…
LeetCode | Subsets II(带有重复数据的数组的子集)
Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Eleme…
LeetCode | Interleaving String(交叉字符串)
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and&n…
LeetCode | Unique Binary Search Trees II(构建二叉搜索树)
Given n, generate all structurally unique BST’s (binary search trees) that store values 1…
LeetCode | Unique Binary Search Trees(二叉搜索树的个数)
Given n, how many structurally unique BST’s (binary search trees) that store values 1R…
LeetCode | Validate Binary Search Tree(有效的二叉搜索树)
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: …
LeetCode | Same Tree(相等的二叉树)
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered eq…
LeetCode | Symmetric Tree(镜像树)
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, th…