2013年12月4日

Word Break II

摘要: Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens="catsanddog",dict=["cat", "cats", "and", "sand", "dog"].A 阅读全文

posted @ 2013-12-04 20:47 waruzhi 阅读(233) 评论(0) 推荐(0) 编辑

Valid Number

摘要: Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementin 阅读全文

posted @ 2013-12-04 17:14 waruzhi 阅读(215) 评论(0) 推荐(0) 编辑

Text Justification

摘要: Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces' 'when necessary so that each line 阅读全文

posted @ 2013-12-04 16:11 waruzhi 阅读(278) 评论(0) 推荐(0) 编辑

String to Integer (atoi)

摘要: Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.Notes:It is intended for this problem to be specified vaguely (ie, no given input specs). You are respo 阅读全文

posted @ 2013-12-04 15:21 waruzhi 阅读(151) 评论(0) 推荐(0) 编辑

Wildcard Matching

摘要: Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover the entire input string (not partial).The function prototype should be:bool i 阅读全文

posted @ 2013-12-04 13:10 waruzhi 阅读(174) 评论(0) 推荐(0) 编辑

导航