摘要: Best Time to Buy and Sell Stock ISay 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 ... 阅读全文
posted @ 2014-05-06 13:59 linyx 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 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-05-05 22:53 linyx 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, ... 阅读全文
posted @ 2014-05-05 20:13 linyx 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initial... 阅读全文
posted @ 2014-05-05 11:16 linyx 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t... 阅读全文
posted @ 2014-05-04 23:21 linyx 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter ca... 阅读全文
posted @ 2014-05-04 13:54 linyx 阅读(602) 评论(0) 推荐(0) 编辑
摘要: 平常在实验室上班,周末老板如果又给个邮件就让我一个周末也没了。这周决定白天一定要出去玩玩,不然宅在宿舍想着老板出的问题也过得太过悲催。昨晚刷完攻略后决定去赤柱。期待的是无敌海景还有沙滩比基尼。攻略上都说吃的贵,作为极品ds也就准备傍晚回来再吃。早上10点左右出发,到达中环再坐260去。坐大巴比坐地铁... 阅读全文
posted @ 2014-05-03 22:59 linyx 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Given 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... 阅读全文
posted @ 2014-05-03 01:55 linyx 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.想法很简单,就是两两合并。在Merge Two Sorted Lists这道题已经实现了两两合并的代码了,就... 阅读全文
posted @ 2014-05-02 21:33 linyx 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 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->2->3 which... 阅读全文
posted @ 2014-05-02 21:11 linyx 阅读(151) 评论(0) 推荐(0) 编辑