摘要: problems:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and... 阅读全文
posted @ 2015-06-08 15:20 尾巴草 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Problems:Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = n... 阅读全文
posted @ 2015-06-08 11:02 尾巴草 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Problem:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in... 阅读全文
posted @ 2015-06-08 10:22 尾巴草 阅读(119) 评论(0) 推荐(0) 编辑
摘要: problem:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.此题目实质为字符串匹配问题,其中比较... 阅读全文
posted @ 2015-06-06 10:06 尾巴草 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 从头到尾彻底理解KMP作者:July时间:最初写于2011年12月,2014年7月21日晚10点 全部删除重写成此文,随后的半个多月不断反复改进。1. 引言 本KMP原文最初写于2年多前的2011年12月,因当时初次接触KMP,思路混乱导致写也写得混乱。所以一直想找机会重新写下KMP,但苦于一直以... 阅读全文
posted @ 2015-06-06 09:51 尾巴草 阅读(278) 评论(0) 推荐(0) 编辑
摘要: KMP字符串模式匹配详解 分类: 算法 2013-02-12 19:26 2380人阅读 评论(0) 收藏 举报 个人觉得这篇文章是网上的介绍有关KMP算法更让人容易理解的文章了,确实说得很“详 细”,耐心地把它看完肯定会有所收获的~~,另外有关模式函数值next[i]确实有很多版本啊,在另外... 阅读全文
posted @ 2015-06-06 09:23 尾巴草 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Problem:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".解法一:全局翻转 局部翻转 核心代码 vo... 阅读全文
posted @ 2015-06-05 22:06 尾巴草 阅读(135) 评论(0) 推荐(0) 编辑
摘要: problem: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 prob... 阅读全文
posted @ 2015-06-05 20:41 尾巴草 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana... 阅读全文
posted @ 2015-06-05 19:38 尾巴草 阅读(153) 评论(0) 推荐(0) 编辑
摘要: probelms:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three ... 阅读全文
posted @ 2015-06-05 10:20 尾巴草 阅读(149) 评论(0) 推荐(0) 编辑