摘要: String to Integer (atoi)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, plea... 阅读全文
posted @ 2014-03-24 20:15 flowerkzj 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest subs 阅读全文
posted @ 2014-03-24 19:46 flowerkzj 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Multiply StringsGiven two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.大数相乘,就是模拟乘法的过程,注意好下标,别忘了最后检查高位的0就好。看代码: 1 class Solution { 2 public: 3 string multiply(string num1, string num2) { 4 ... 阅读全文
posted @ 2014-03-24 18:20 flowerkzj 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 对排序数组中重复元素的删除操作,这里分两种情况,一种是重复的元素合并,另一种是重复元素的删除。先从简单的做起:合并Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, return1->2->3.这个就跟数组中重复元素合并差不多,只需要考虑 阅读全文
posted @ 2014-03-24 02:04 flowerkzj 阅读(181) 评论(0) 推荐(0) 编辑