算法
梦中的冰原
这个作者很懒,什么都没留下…
展开
-
[LeetCode]Longest Substring Without Repeating Characters
Description: Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b原创 2017-05-27 08:04:17 · 167 阅读 · 0 评论 -
[LeetCode]ZigZag Conversion
Description:The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H N A原创 2017-05-31 08:06:40 · 225 阅读 · 0 评论 -
[LeetCode]Median of Two Sorted Arrays
Description: There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1原创 2017-06-05 07:21:16 · 178 阅读 · 0 评论 -
[LeetCode]String to Integer (atoi)
Description: Implement atoi to 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原创 2017-06-05 07:34:38 · 230 阅读 · 0 评论 -
剑指offer:查找链表中倒数第k个结点
解题思路:其实查找链表中倒数第k个结点,可以转化为顺数第几个结点。架设链表长度为n,那么我们会发现,顺数结点p+k = n+1;所以顺数结点p = n-k+1;这样的话,答案很容易就出来了。public ListNode FindKthToTail(ListNode head, int k){ if(head == null)return null; ListNode ret = h原创 2017-06-09 08:03:28 · 201 阅读 · 0 评论 -
[LeetCode]3Sum Closest
Description: 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 integers. You may assume that each input would原创 2017-06-30 07:58:20 · 207 阅读 · 0 评论 -
KMP算法理解
KMP算法求解什么类型问题 字符串匹配。给你两个字符串,寻找其中一个字符串是否包含另一个字符串,如果包含,返回包含的起始位置。 如下面两个字符串:char *str = "bacbababadababacambabacaddababacasdsd";char *ptr = "ababaca";str有两处包含ptr 分别在str的下标10,26处包含ptr。“bacbababadabab原创 2017-07-16 16:39:10 · 278 阅读 · 0 评论