题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: P...
分类:
其他好文 时间:
2015-05-03 23:27:29
阅读次数:
113
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.
注:回数是指正读和倒读都一样的数:需要注意点
(1)负数不是回数
(2)个位数都是回数
思路:
(1)使用前一题的整数的倒序,将一个数倒序,然后和原值比较:存在的问题是可能有溢出...
分类:
其他好文 时间:
2015-05-03 17:34:33
阅读次数:
114
快速排序的一个特点是:每一次分区(partition)操作之后,就有一个元素被放在了数组的最终位置,在以后的排序过程中该元素位置不会变动;
利用这个特点我们可以将快速排序稍加改造来寻找第k个最小值,假设在一次分区操作之后中枢(pivot)的位置在k之前,那么我们下次只需要在中枢的后面进行查找;如果中枢的位置在k之后,那么我们下次只需要在中枢之前进行查找,直到中枢等于k为止。
我们知道快速排序的...
分类:
编程语言 时间:
2015-05-03 09:19:45
阅读次数:
141
一:表分区的应用场景 用于管理包含大量数据的表。二:表分区的优点 1.提高数据的可以性 2.减少管理负担 3.改善语句的性能三:分区的方式:(区间分区、散列分区、列表分区、组合分区) 1.区间分区(范围分区 range) 创建区间分区的语法: PARTITION BY RA...
分类:
数据库 时间:
2015-05-02 18:07:59
阅读次数:
264
./configure--prefix=/usr/local/mysql--with-extra-charsets=all--with-innodb--with-plugins=partition然后进行make报如下错误../depcomp:line571:exec:g++:notfoundmake[1]:***[my_new.o]Error127make[1]:Leavingdirectory`/usr/local/src/mysql-5.1.34/mysys‘make:***[all-..
分类:
数据库 时间:
2015-05-01 20:07:19
阅读次数:
157
1.题目Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a pali...
分类:
其他好文 时间:
2015-05-01 18:46:29
阅读次数:
129
题目:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, ...
分类:
其他好文 时间:
2015-05-01 00:32:38
阅读次数:
150
题目:
数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2。
解法一:
先将数组排序,然后出现次数超过一半的数字就是a[n/2+1],时间复杂度O(nlgn)。
解法二:O(n)
基本思想:
消除原理:在遍历数组的时候保存两个值:一个...
分类:
编程语言 时间:
2015-04-30 14:23:07
阅读次数:
91
网址:https://leetcode.com/problems/palindrome-number/
题意:
判断int数是不是回文.
解法:
先遍历一遍,得到数值位数.
再前后判断是不是回文
注意不能是负数.
代码:
https://github.com/LiLane/leetcode/blob/master/c%2B%2B/009-PalindromeNumber-20150...
分类:
其他好文 时间:
2015-04-30 12:36:59
阅读次数:
126
Determine whether an integer is a palindrome. Do this without extra space.类似于reverse integer。public class Solution { public boolean isPalindrome(...
分类:
其他好文 时间:
2015-04-30 07:36:35
阅读次数:
119