fight to dead的博客

死亡倒计时

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 values along the path equals th...

2015-05-14 22:13:41

阅读数 223

评论数 0

Leetcode Sum Root to Leaf Numbers

题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1...

2015-05-14 21:55:52

阅读数 286

评论数 0

Leetcode Binary Tree Right Side View

题目: 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 b...

2015-05-14 11:32:03

阅读数 195

评论数 0

Leetcode Binary Search Tree Iterator 二叉搜索树迭代器

题目: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() ...

2015-05-14 11:18:19

阅读数 224

评论数 0

Leetcode Populating Next Right Pointers in Each Node II

题目: Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would...

2015-05-14 10:53:12

阅读数 187

评论数 0

Leetcode Populating Next Right Pointers in Each Node

题目: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } ...

2015-05-14 10:41:48

阅读数 213

评论数 0

Leetcode Minimum Depth of Binary Tree 二叉树最小深度

题目: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down...

2015-05-13 17:43:17

阅读数 242

评论数 0

Leetcode Construct Binary Tree from Inorder and Postorder Traversal 中序后序遍历重组二叉树

题目: Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the...

2015-05-13 17:00:21

阅读数 357

评论数 0

Leetcode Construct Binary Tree from Preorder and Inorder Traversal 前序中序遍历重组二叉树

题目: Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the ...

2015-05-13 16:29:44

阅读数 325

评论数 0

Leetcode Single Number

题目: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a lin...

2015-05-12 18:19:01

阅读数 189

评论数 0

Leetcode Balanced Binary Tree 平衡二叉树

题目: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree ...

2015-05-12 14:55:22

阅读数 254

评论数 0

Leetcode Convert Sorted Array to Binary Search Tree 有序数组转换成二叉搜索树BST

题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 分析: 这道题和有序链表转换成BST的方法相同,都是用递归。  1. ...

2015-05-12 12:20:47

阅读数 320

评论数 1

Leetcode Triangle

题目: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For exam...

2015-05-12 11:34:33

阅读数 190

评论数 0

Leetcode Unique Paths II

题目: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? ...

2015-05-11 22:58:51

阅读数 160

评论数 0

Leetcode Unique Paths

题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down ...

2015-05-11 22:42:17

阅读数 186

评论数 0

Leetcode Best Time to Buy and Sell Stock

题目: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at mos...

2015-05-11 22:32:59

阅读数 248

评论数 0

Leetcode House Robber

题目: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constrai...

2015-05-11 20:49:59

阅读数 209

评论数 0

Leetcode Climbing Stairs 爬楼梯

题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinc...

2015-05-11 20:34:50

阅读数 238

评论数 0

动态规划题目思路

做动态规划题目主要考虑的几个方面: 1. 每一个状态的含义,其中蕴含了怎样的小规模问题的结果 2. 状态之间的关系,即如何通过小规模的状态计算大规模的状态 3. 初始化状态,首先找到最小的问题的状态 3. 结果,哪一个状态是最终需要的结果 什么情况下想到用动态规划: ...

2015-05-11 20:24:16

阅读数 184

评论数 0

Leetcode Binary Tree Postorder Traversal 二叉树后序遍历

题目: Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ ...

2015-05-11 19:48:03

阅读数 209

评论数 0

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