摘要: Word Ladder IIFeb 11Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) fromstart toend, such that:Only one letter can be changed at a timeEach intermediate word must exist in the dictionaryFor example,Given:start = "hit"end = "cog"dict 阅读全文
posted @ 2013-02-22 10:29 西施豆腐渣 阅读(516) 评论(0) 推荐(0) 编辑
摘要: Sum Root to Leaf Numbers2 daysGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find the total sum of all root-to-leaf numbers.For example, 1 / \ 2 3 The root-to-leaf p... 阅读全文
posted @ 2013-02-22 05:38 西施豆腐渣 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Longest Consecutive SequenceFeb 14Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is[1, 2, 3, 4]. Return its length:4.Your algorithm should run in O(n) complexity.publi 阅读全文
posted @ 2013-02-22 04:27 西施豆腐渣 阅读(175) 评论(0) 推荐(0) 编辑