2014年11月26日

摘要: Max Points on a LineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.SOLUTION 1:全部的点扫一次,然后计算每一个点与其它点... 阅读全文
posted @ 2014-11-26 19:45 Yu's Garden 阅读(676) 评论(0) 推荐(0) 编辑

2014年11月25日

摘要: Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the t... 阅读全文
posted @ 2014-11-25 19:53 Yu's Garden 阅读(2202) 评论(1) 推荐(0) 编辑

2014年11月24日

摘要: Word Ladder II Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one l... 阅读全文
posted @ 2014-11-24 19:55 Yu's Garden 阅读(1665) 评论(0) 推荐(0) 编辑
摘要: Count and SayThe count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11... 阅读全文
posted @ 2014-11-24 10:41 Yu's Garden 阅读(726) 评论(0) 推荐(0) 编辑

2014年11月23日

摘要: Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.SOLUTION 1:思路:从后往前遍历罗马数字,如果某... 阅读全文
posted @ 2014-11-23 20:05 Yu's Garden 阅读(621) 评论(0) 推荐(0) 编辑
摘要: Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.SOLUTION 1:思路:从后往前遍历罗马数字,如果某... 阅读全文
posted @ 2014-11-23 18:43 Yu's Garden 阅读(421) 评论(0) 推荐(0) 编辑
摘要: Integer to Roman Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.SOLUTION 1:从大到小的贪心写法。从大到小匹配... 阅读全文
posted @ 2014-11-23 17:06 Yu's Garden 阅读(545) 评论(0) 推荐(0) 编辑
摘要: ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern... 阅读全文
posted @ 2014-11-23 16:04 Yu's Garden 阅读(803) 评论(0) 推荐(0) 编辑
摘要: Multiply StringsGiven two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large ... 阅读全文
posted @ 2014-11-23 10:33 Yu's Garden 阅读(619) 评论(0) 推荐(0) 编辑
摘要: Wildcard MatchingImplement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of charact... 阅读全文
posted @ 2014-11-23 09:22 Yu's Garden 阅读(7726) 评论(0) 推荐(2) 编辑

导航