leetcode 109 Convert Sorted List to Binary Search Tree ----- java
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 和上一题类似,把数组换成链表,所以可以两种做法: 1、把链表换成数组,然后用上一
阅读全文
leetcode 108 Convert Sorted Array to Binary Search Tree ----- java
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 给一个排好序的数组,然后求搜索二叉树 其实就是二分法,不难。
阅读全文
leetcode 107 Binary Tree Level Order Traversal II ----- java
摘要:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For
阅读全文
leetcode 106 Construct Binary Tree from Inorder and Postorder Traversal----- java
摘要:Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 和上一道题基本一样 根据
阅读全文
leetcode 105 Construct Binary Tree from Preorder and Inorder Traversal ----- java
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 给出前序遍历和中序遍历,然
阅读全文
leetcode 104 Maximum Depth of Binary Tree ----- java
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l
阅读全文
leetcode 103 Binary Tree Zigzag Level Order Traversal ----- java
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and
阅读全文
leetcode 102 Binary Tree Level Order Traversal ----- java
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree [3
阅读全文
leetcode 99 Recover Binary Search Tree ----- java
摘要:Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) space i
阅读全文
leetcode 101 Symmetric Tree ----- java
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet
阅读全文
leetcode 100 Same Tree ----- java
摘要:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a
阅读全文
leetcode 98 Validate Binary Search Tree ----- java
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only
阅读全文
leetcode 97 Interleaving String ----- java
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac", ret
阅读全文
leetcode 95 Unique Binary Search Trees II ----- java
摘要:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should
阅读全文
leetcode 96 Unique Binary Search Trees ----- java
摘要:Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST'
阅读全文
leetcode 94 Binary Tree Inorder Traversal ----- java
摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. Note: Recursive so
阅读全文
leetcode 93 Restore IP Addresses ----- java
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return ["2
阅读全文
leetcode 92 Reverse Linked List II ----- java
摘要:Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2-
阅读全文
leetcode 91 Decode Ways ----- java
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message containing digits, determine t
阅读全文
leetcode 90 Subsets II ----- java
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate sub
阅读全文
|
|
|