摘要: Given two words (startandend), and a dictionary, find all shortest transformation sequence(s) fromstarttoend, such that:Only one letter can be changed... 阅读全文
posted @ 2014-07-03 10:03 穆穆兔兔 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 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 the given sum.Fo... 阅读全文
posted @ 2014-07-03 09:47 穆穆兔兔 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be ... 阅读全文
posted @ 2014-07-01 10:37 穆穆兔兔 阅读(472) 评论(1) 推荐(0) 编辑
摘要: DFS 深度优先BFS 广度优先DFS或者BFS都是在联通区域内遍历节点的方法用在二叉树上DFS有preOreder,inOrder,postOrder,BFS就是层次遍历。在二叉树上的节点,只有两个选择,left 和right,即,对于每一个节点,in 有1个, out 有两个,有向图在矩阵的节点... 阅读全文
posted @ 2014-06-30 15:12 穆穆兔兔 阅读(628) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region... 阅读全文
posted @ 2014-06-30 11:25 穆穆兔兔 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100". 1 class Solution 2 { 3 public: 4 ... 阅读全文
posted @ 2014-06-29 22:25 穆穆兔兔 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2014-06-29 21:41 穆穆兔兔 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp... 阅读全文
posted @ 2014-06-27 23:21 穆穆兔兔 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity... 阅读全文
posted @ 2014-06-27 22:45 穆穆兔兔 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.方法:在inorder中寻找... 阅读全文
posted @ 2014-06-27 22:40 穆穆兔兔 阅读(160) 评论(0) 推荐(0) 编辑