摘要: 题目:http://www.itint5.com/oj/#10有n个任务需要完成(编号1到n),任务之间有一些依赖关系,如果任务a依赖于任务b和c,那么只有当任务b和任务c完成之后才能完成任务a。给定所有的依赖关系,判断这些任务是否能够完成。如果能够完成,请给出一个合法的任务完成序列。样例:n=51... 阅读全文
posted @ 2014-07-27 21:52 beehard 阅读(372) 评论(0) 推荐(0) 编辑
摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line. 1 /** 2 * Definition for a point. 3 * struct Point... 阅读全文
posted @ 2014-04-24 11:16 beehard 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be c... 阅读全文
posted @ 2014-04-24 10:59 beehard 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the". 1 class Solution { 2 public: ... 阅读全文
posted @ 2014-04-24 10:57 beehard 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another e... 阅读全文
posted @ 2014-04-24 10:48 beehard 阅读(160) 评论(0) 推荐(0) 编辑
摘要: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep cop... 阅读全文
posted @ 2014-04-24 10:25 beehard 阅读(147) 评论(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 ... 阅读全文
posted @ 2014-04-24 09:49 beehard 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended fo... 阅读全文
posted @ 2014-04-24 09:33 beehard 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning... 阅读全文
posted @ 2014-04-24 08:41 beehard 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", ... 阅读全文
posted @ 2014-04-24 08:29 beehard 阅读(143) 评论(0) 推荐(0) 编辑