简历:The Google Resume: How to Prepare for a Career and Land a Job at Apple, Microsoft, Google, or any Top Tech Company
算法学习书籍:Introduction to Algorithms
编程珠玑:Programming Pearls (2nd Edition)
C++ 学习:The C++ Programming Language, 4th Edition
经典操作系统书籍,龙书:Operating System Concepts
创业:The Start-up of You: Adapt to the Future, Invest in Yourself, and Transform Your Career
Longest Palindromic Substring: Given a string S, find the longest palindromic substring in S.
My first thought came up is reversing the string then find the longest common substring of S and S'. While there is obvious flaw in this algorithm.
Can take a look of solution over here.
http://leetcode.com/2011/11/longest-palindromic-substring-part-i.html
http://leetcode.com/2011/11/longest-palindromic-substring-part-ii.html
There is a O(n) solution over here which is very elegant and concise, while is a little bit hard to understand. Here is a good explanation in Chinese. Check it out. http://www.felix021.com/blog/read.php?2040
One problem that I want to think: When you design a algorithm for a problem, how could you prove that your algorithm is correct, complete and flawless in a systematic way? Everyone has blind point when thinking a problem. So how to avoid the blind point and think a problem completely?
Here is the useful link of statistic information of difficulty and frequency of leetcode problems.
https://docs.google.com/spreadsheet/pub?key=0Aqt--wSNYfuxdGxQWVFsOGdVVWxQRlNUVXZTdEpOeEE&output=html
The link of difficulty distribution for leetcode problems is ver useful. Thx a lot!
ReplyDeleteYour first thought works, only it can't pass large test. Why you said it has obvious flaw?
ReplyDeleteThis comment has been removed by the author.
Delete