原创 leetcode005 Longest Palindromic Substring

題目 5. Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. You may assume t

原创 leetcode013 Roman to Integer

題目 13. Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the ra

原创 修改MYSQL默認編碼爲UTF8

原文地址:http://blog.chinaunix.net/uid-10697776-id-2935588.html MySQL的默認編碼是Latin1,不支持中文,那麼如何修改MySQL的默認編碼呢,下面以UTF-8爲例來說明 需要

原创 在YouCompleteMe+Syntastic中添加和取消對C++11的支持

添加對c++11的支持: /.vimrc中添加:   let g:syntastic_cpp_compiler = ‘g++‘  "change the compiler to g++ to support c++11.    le

原创 leetcode003 Longest Substring Without Repeating Characters

題目 3. Longest Substring Without Repeating Characters Given a string, find the length of the longest substring with

原创 leetcode014 Longest Common Prefix

題目 14. Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings

原创 leetcode012 Integer to Roman

題目 12. Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the ra

原创 leetcode015 3Sum

題目 15. 3 Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all uni

原创 leetcode006 ZigZag Conversion

題目 6. ZigZag Conversion The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like

原创 leetcode007 Reverse Integer

題目 7. Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321

原创 leetcode002 Add Two Numbers

題目 2. Add Two Numbers You are given two linked lists representing two non-negative numbers. The digits are stored

原创 每日一算法----KMP算法

模式匹配算法,KMP #include <stdio.h> /* 計算next數組 */ void get_next(char* T, int *next) { int i = 1; int j = 0;

原创 leetcode008 String to Integer (atoi)

題目 8. String to Integer (atoi) Implement atoi to convert a string to an integer. Hint: Carefully consider all pos

原创 leetcode001 TwoSum

題目 1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific ta

原创 leetcode017 Letter Combinations of a Phone Number

題目 17. Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that th