排序:
默认
按更新时间
按访问量
RSS订阅

[剑指offer] 重建二叉树

Description:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。Solution:/** * Def...

2018-03-31 16:53:11

阅读数 31

评论数 0

[LeetCode] 747. Min Cost Climbing Stairs

Problem: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb...

2018-01-03 21:03:40

阅读数 80

评论数 0

[LeetCode] 394. Decode String

Problem: Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square...

2018-01-02 12:31:57

阅读数 63

评论数 0

[LeetCode] 199. Binary Tree Right Side View

Problem: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bot...

2017-12-23 13:40:19

阅读数 50

评论数 0

[LeetCode] 494. Target Sum

Problem: You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you sh...

2017-12-21 20:36:16

阅读数 60

评论数 0

[LeetCode] 416. Partition Equal Subset Sum

Problem: Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elem...

2017-12-21 19:28:48

阅读数 53

评论数 0

[LeetCode] 337. House Robber III

Problem: The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besi...

2017-12-17 21:55:41

阅读数 62

评论数 0

[LeetCode] Convert Sorted Array to Binary Search Tree

Problem: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balance...

2017-12-16 13:13:54

阅读数 66

评论数 0

[LeetCode] 100. Same Tree

Problem: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are ...

2017-12-16 11:45:29

阅读数 58

评论数 0

[LeetCode] 547. Friend Circles

Problem: There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A...

2017-12-15 23:38:47

阅读数 48

评论数 0

[LeetCode] 695. Max Area of Island

Problem: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal...

2017-11-28 19:19:11

阅读数 106

评论数 0

[LeetCode] 515. Find Largest Value in Each Tree Row

Problem: You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \...

2017-11-18 14:32:33

阅读数 71

评论数 0

[LeetCode] 513. Find Bottom Left Tree Value

Problem: Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example...

2017-10-15 23:58:21

阅读数 76

评论数 0

[LeetCode] 690. Employee Importance

Problem : You are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsu...

2017-10-07 11:19:44

阅读数 81

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭