摘要: Find the CelebritySuppose you are at a party withnpeople (labeled from0ton - 1) and among them, there may exist one celebrity. The definition of a cel... 阅读全文
posted @ 2015-09-06 13:11 Eason Liu 阅读(7157) 评论(0) 推荐(0) 编辑
摘要: Longest Substring with At Most Two Distinct CharactersGiven a string, find the length of the longest substring T that contains at most 2 distinct char... 阅读全文
posted @ 2015-09-06 11:37 Eason Liu 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Read N Characters Given Read4The API:int read4(char *buf)reads 4 characters at a time from a file.The return value is the actual number of characters ... 阅读全文
posted @ 2015-09-06 11:33 Eason Liu 阅读(605) 评论(0) 推荐(0) 编辑
摘要: Meeting RoomsGiven an array of meeting time intervals consisting of start and end times[[s1,e1],[s2,e2],...](si& intervals) {13 sort(intervals... 阅读全文
posted @ 2015-09-06 11:29 Eason Liu 阅读(366) 评论(0) 推荐(0) 编辑
摘要: Graph Valid TreeGivennnodes labeled from0ton - 1and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these... 阅读全文
posted @ 2015-09-06 11:17 Eason Liu 阅读(531) 评论(0) 推荐(0) 编辑
摘要: Palindrome PermutationGiven a string, determine if a permutation of the string could form a palindrome.For example,"code"-> False,"aab"-> True,"carera... 阅读全文
posted @ 2015-09-06 11:12 Eason Liu 阅读(923) 评论(0) 推荐(0) 编辑
摘要: Encode and Decode StringsDesign an algorithm to encodea list of stringstoa string. The encoded string is then sent over the network and is decoded bac... 阅读全文
posted @ 2015-09-06 11:08 Eason Liu 阅读(1442) 评论(0) 推荐(0) 编辑
摘要: Paint FenceThere is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two... 阅读全文
posted @ 2015-09-06 11:01 Eason Liu 阅读(1174) 评论(0) 推荐(0) 编辑
摘要: Paint HouseThere are a row ofnhouses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with... 阅读全文
posted @ 2015-09-06 10:56 Eason Liu 阅读(2182) 评论(0) 推荐(0) 编辑
摘要: Shortest Word DistanceGiven a list of words and two wordsword1andword2, return the shortest distance between these two words in the list.For example,A... 阅读全文
posted @ 2015-09-06 10:51 Eason Liu 阅读(2123) 评论(0) 推荐(0) 编辑