
Lintcode
screaming
这个作者很懒,什么都没留下…
展开
-
Find a Peak Element
Find a peak elementGiven an array of integers. Find a peak element in it. An array element is peak if it is NOT smaller than its neighbors. For corner elements, we need to consider only one neig转载 2016-01-20 22:41:39 · 413 阅读 · 0 评论 -
K most frequent words from a file
The Most Efficient Way To Find Top K Frequent Words In A Big Word Sequenceup vote46down votefavorite34Input: A positive integer K and a big text. The text can a转载 2016-06-18 15:50:49 · 1091 阅读 · 0 评论 -
ladder BFS
leetcode BFS 2015年3月7日 hrwhisper Leave a comment 649 views 本次题解包括:126 Word Ladder II127 Word Ladder130 Surrounded Regions127 Word LadderGiven two words (start and end), and a dict转载 2016-06-15 23:08:22 · 454 阅读 · 0 评论 -
word ladder - shortest path
单词变换距离 Word Ladder (图的最短路径) 2014-02-28 20:15 832人阅读 评论(0) 收藏 举报 分类: 算法基础(19) 图解法问题(13) 字符串问题(44) LeetCode(150) 版权声明: GNU General Public License. http://lucky转载 2016-06-15 12:27:07 · 405 阅读 · 0 评论 -
trapping water
LeetCode:Container With Most Water,Trapping Rain WaterContainer With Most Water题目链接Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n转载 2016-06-12 07:06:02 · 317 阅读 · 0 评论 -
word ladder2
Word Ladder II描述Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from startto end, such that:• Only one letter can be changed at a time转载 2016-06-11 23:28:34 · 568 阅读 · 0 评论 -
word ladder
链接:http://leetcode.com/onlinejudge#question_126原题:Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only on转载 2016-06-11 23:27:26 · 447 阅读 · 0 评论 -
word ladder
leetcode之word ladder 标签: leetcode2013-10-20 19:30 10736人阅读 评论(5) 收藏 举报本文章已收录于: 算法与数据结构知识库 分类: leetcode(5) 版权声明:本文为博主原创文章,未经博主允许不得转载。对于之前没有接触过该类型题目的人来说,此题无疑转载 2016-06-11 23:25:23 · 373 阅读 · 0 评论 -
word ladder
单词变换距离 Word Ladder (图的最短路径) 2014-02-28 20:15 830人阅读 评论(0) 收藏 举报 分类: 算法基础(19) 图解法问题(13) 字符串问题(44) LeetCode(150) 版权声明: GNU General Public License. http://lucky转载 2016-06-11 23:24:24 · 376 阅读 · 0 评论 -
word ladder
[leetcode]Word Ladder II @ Python[leetcode]Word Ladder II @ Python原题地址:http://oj.leetcode.com/problems/word-ladder-ii/参考文献:http://blog.youkuaiyun.com/doc_sgl/article/details/13341405转载 2016-06-11 23:23:36 · 346 阅读 · 0 评论 -
longest continuous subsequence of 0s
How can we find the longest continuous subsequence of 0's in binary representation of an integer in O(log n) time complexity?Michal Forišek, teacher, scientist, c转载 2016-03-23 19:12:43 · 342 阅读 · 0 评论 -
Binary Tree Maximum Path Sum
Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.求树的一点到另一点的最大路径,利用递归的方法,ans 在 左子树,右子树,root+左+右的最大中产生。/*转载 2016-02-25 14:10:19 · 249 阅读 · 0 评论 -
maximum subarray
最大子串和问题(Maximum Subarray) 标签: 算法2011-10-10 16:46 14186人阅读 评论(11) 收藏 举报版权声明:本文为博主原创文章,未经博主允许不得转载。又一个经典问题,对于一个包含负值的数字串array[1...n],要找到他的一个子串array[i...j](0这里我们需要注意子串和子序列之间的区别。子串是指转载 2016-03-18 22:00:01 · 234 阅读 · 0 评论 -
Minimum Depth of a Binary Tree
Find Minimum Depth of a Binary TreeGiven a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from root node down to the nearest leaf node.转载 2016-03-03 21:31:01 · 304 阅读 · 0 评论 -
Level Order Tree Traversal
Level Order Tree TraversalLevel order traversal of a tree is breadth first traversal for the tree.Example TreeLevel order traversal of the above tree is 1 2 3 4 5 METHOD 1 (Use function转载 2016-03-02 14:23:35 · 488 阅读 · 0 评论 -
Find the Minimum Element in A sorted and Rotated Array
Find the minimum element in a sorted and rotated arrayA sorted array is rotated at some unknown point, find the minimum element in it. Following solution assumes that all elements are distin转载 2016-01-20 22:43:15 · 325 阅读 · 0 评论 -
python heapq
python heapq这个模块(build-in)实现了一个堆的数据结构,完美的解决了Top-K问题,以后解决Top-K问题的时候,直接把这个模块拿来用就可以了注意,默认的heap是一个小顶堆! heapq模块提供了如下几个函数:heapq.heappush(heap, item) 把item添加到heap中(heap是一个列表)heapq.he转载 2016-06-18 18:50:03 · 647 阅读 · 0 评论