上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 34 下一页

2015年3月13日

Construct Binary Tree from Inorder and Postorder Traversal

摘要: Construct Binary Tree from Inorder and Postorder Traversal问题: Given inorder and postorder traversal of a tree, construct the binary tree.思路: dfs我的代码... 阅读全文

posted @ 2015-03-13 20:10 zhouzhou0615 阅读(95) 评论(0) 推荐(0) 编辑

Triangle

摘要: 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.思路: 简单的动态规划问题我... 阅读全文

posted @ 2015-03-13 19:52 zhouzhou0615 阅读(113) 评论(0) 推荐(0) 编辑

Binary Search Tree Iterator

摘要: 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.Cal... 阅读全文

posted @ 2015-03-13 19:37 zhouzhou0615 阅读(134) 评论(0) 推荐(0) 编辑

Convert Sorted List to Binary Search Tree

摘要: Convert Sorted List to Binary Search Tree问题:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced B... 阅读全文

posted @ 2015-03-13 17:11 zhouzhou0615 阅读(117) 评论(0) 推荐(0) 编辑

Rotate List

摘要: Rotate List问题:Given a list, rotate the list to the right bykplaces, wherekis non-negative.思路: 简单的数学推导问题我的代码:public class Solution { public ListNod... 阅读全文

posted @ 2015-03-13 16:32 zhouzhou0615 阅读(114) 评论(0) 推荐(0) 编辑

3Sum Closest

摘要: 3Sum Closest问题:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three ... 阅读全文

posted @ 2015-03-13 16:07 zhouzhou0615 阅读(143) 评论(0) 推荐(0) 编辑

3Sum

摘要: 3Sum问题: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.思路... 阅读全文

posted @ 2015-03-13 15:41 zhouzhou0615 阅读(145) 评论(0) 推荐(0) 编辑

Two Sum

摘要: Two Sum问题:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of ... 阅读全文

posted @ 2015-03-13 14:44 zhouzhou0615 阅读(125) 评论(0) 推荐(0) 编辑

Binary Tree Maximum Path Sum

摘要: Binary Tree Maximum Path Sum问题:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.思路: dfs我的代码:public c... 阅读全文

posted @ 2015-03-13 10:51 zhouzhou0615 阅读(115) 评论(0) 推荐(0) 编辑

Path Sum II

摘要: Path Sum II问题:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.思路: dfs + 回溯我的代码:public class Sol... 阅读全文

posted @ 2015-03-13 10:07 zhouzhou0615 阅读(118) 评论(0) 推荐(0) 编辑

上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 34 下一页

导航