Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the…
分类:LeetCode题目解答
LeetCode | Linked List Cycle
题目: Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra sp…
[Leetcode] Two Sum 两数和
Two Sum Given an array of integers, find two numbers such that they add up to a specific target number. The fu…
[LeetCode] Cherry Pickup 捡樱桃
In a N x N grid representing a field of cherries, each cell is one of three possible integers…
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…
409. Longest Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes th…
[Leetcode] Pascal's Triangle 杨辉三角形
Pascal’s Triangle I Given numRows, generate the first numRows of Pascal’s triangle. For example, g…
【leetcode】47. Permutations II 非重复的所有组合
1. 题目 Given a collection of numbers that might contain duplicates, return all possible unique permutations. Fo…
[LeetCode] Count of Range Sum 区间和计数
Given an integer array nums, return the number of range sums that lie in [lower, upper] …
[LeetCode] Third Maximum Number 第三大的数
Given a non-empty array of integers, return the third maximum number in this array.…
[LeetCode] Interleaving String 交织相错的字符串,Word Break 拆分词句
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = …
[LeetCode] Kth Smallest Element in a BST 二叉搜索树中的第K小的元素,Validate Binary Search Tree 验证二叉搜索树,Recover Binary Search Tree 复原二叉搜索树,Binary Search Tree Iterator 二叉搜索树迭代器,Unique Binary Search Trees 独一无二的二叉搜索树,Unique Binary Search Trees II 独一无二的二叉搜索树之二,Convert Sorted Array to Binary Search Tree 将有序数组转为二叉搜索树,Convert Sorted List to Binary Search Tree 将有序链表转为二叉搜索树,Binary Tree Inorder Traversal 二叉树的中序遍历
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: …