2014年7月31日

Decode Ways

摘要: Description:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded m... 阅读全文

posted @ 2014-07-31 23:42 soyscut 阅读(178) 评论(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 ... 阅读全文

posted @ 2014-07-31 23:34 soyscut 阅读(174) 评论(0) 推荐(0) 编辑

Leetcode:Reverse Words in a String

摘要: Description:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What... 阅读全文

posted @ 2014-07-31 23:09 soyscut 阅读(168) 评论(0) 推荐(0) 编辑

2014年7月23日

Leetcode: Substring with Concatenation of All Words

摘要: Description:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a... 阅读全文

posted @ 2014-07-23 18:32 soyscut 阅读(174) 评论(0) 推荐(0) 编辑

Leetcode:Palindrome Partitioning II

摘要: Description:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome part... 阅读全文

posted @ 2014-07-23 18:26 soyscut 阅读(150) 评论(0) 推荐(0) 编辑

2014年6月21日

翻转链表-迭代和递归双版本

摘要: 将一个链表翻转,如 1->2->3->4 变成 4->3->2->1 的链表。这是一个非常著名的面试题,看似非常的简单,但实际上非常的tricky.实现方法可以有递归和迭代两种方法,这两个算法也都保证了in-place 和 one-pass. 所以效率还是很高的。这篇文章主要基于http://lee... 阅读全文

posted @ 2014-06-21 22:30 soyscut 阅读(2002) 评论(4) 推荐(0) 编辑

2014年6月20日

(转)C++重写、重载和重定义的区别

摘要: C++ 重写重载重定义区别(源自:http://blog.163.com/clevertanglei900@126/blog/static/111352259201102441934870/)1 成员函数重载特征: a 相同的范围(在同一个类中) b 函数名字相同 c 参数不同 d virtual关... 阅读全文

posted @ 2014-06-20 15:02 soyscut 阅读(190) 评论(0) 推荐(0) 编辑

2014年6月18日

Leetcode:Letter Combinations of a Phone Number

摘要: Description:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on ... 阅读全文

posted @ 2014-06-18 21:49 soyscut 阅读(197) 评论(0) 推荐(0) 编辑

Leetcode:Pow(x,n)

摘要: Description: Implement pow(x,n).分析: 求幂次运算,典型的分治算法来解。 因为pow(x,n/2)*pow(x,n/2) 有着重复运算,分治法就会非常快O(log n) 1 class Solution { 2 public: 3 double findval... 阅读全文

posted @ 2014-06-18 21:41 soyscut 阅读(183) 评论(0) 推荐(0) 编辑

Leetcode:Combination Sum

摘要: Description:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesame... 阅读全文

posted @ 2014-06-18 21:36 soyscut 阅读(337) 评论(0) 推荐(0) 编辑

导航