2014年12月3日

Populating Next Right Pointers in Each Node

摘要: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe... 阅读全文

posted @ 2014-12-03 20:30 code#swan 阅读(115) 评论(0) 推荐(0)

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 your previous solution stil... 阅读全文

posted @ 2014-12-03 20:28 code#swan 阅读(128) 评论(0) 推荐(0)

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.For example:Given the below binary tree andsum =... 阅读全文

posted @ 2014-12-03 20:14 code#swan 阅读(93) 评论(0) 推荐(0)

Distinct Subsequences

摘要: Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig... 阅读全文

posted @ 2014-12-03 20:13 code#swan 阅读(103) 评论(0) 推荐(0)

Pascal's Triangle II

摘要: Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(... 阅读全文

posted @ 2014-12-03 20:10 code#swan 阅读(116) 评论(0) 推荐(0)

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 example, given the fol... 阅读全文

posted @ 2014-12-03 20:09 code#swan 阅读(87) 评论(0) 推荐(0)

Best Time to Buy and Sell Stock

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文

posted @ 2014-12-03 20:04 code#swan 阅读(85) 评论(0) 推荐(0)

Best Time to Buy and Sell Stock II

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文

posted @ 2014-12-03 20:03 code#swan 阅读(79) 评论(0) 推荐(0)

Best Time to Buy and Sell Stock III

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文

posted @ 2014-12-03 20:02 code#swan 阅读(104) 评论(0) 推荐(0)

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.For example:Given the below binary tree, 1 ... 阅读全文

posted @ 2014-12-03 20:00 code#swan 阅读(101) 评论(0) 推荐(0)

导航