摘要: Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The... 阅读全文
posted @ 2015-07-19 13:37 Mad.King 阅读(162) 评论(0) 推荐(0)
摘要: 题意将一个含数字的字符串转换成int型思路实现并不困难,主要考虑各种情况。1.字符串是不是空字符串;2.字符串带空格或其他字符怎么办;3.带正负号的处理;4.字符串中的数超过int型的范围怎么办(int 范围:-2147483648~2147483647 0x80000000~0x7fffffff)... 阅读全文
posted @ 2015-07-19 13:27 Mad.King 阅读(135) 评论(0) 推荐(0)
摘要: 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 fo... 阅读全文
posted @ 2015-07-19 13:12 Mad.King 阅读(184) 评论(0) 推荐(0)
摘要: (转载)LeetCode上一道求回文字符串的问题,通常容易想到的是暴力和动态规划的方法,时间复杂度为O(n^2),后来看到有一种更巧妙的算法,Manacher’s algorithm,时间复杂度为O(n)。参考大神的博客,记下来自己的理解,方便日后查阅。1.预处理首先,由于通常情况下,对于奇数长度和... 阅读全文
posted @ 2015-07-19 12:13 Mad.King 阅读(245) 评论(0) 推荐(0)
摘要: There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文
posted @ 2015-07-18 21:10 Mad.King 阅读(123) 评论(0) 推荐(0)
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2015-07-18 20:57 Mad.King 阅读(128) 评论(0) 推荐(0)
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2015-07-18 19:54 Mad.King 阅读(95) 评论(0) 推荐(0)
摘要: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2015-07-16 22:12 Mad.King 阅读(122) 评论(0) 推荐(0)