题目:
Determine whether an integer is a palindrome. Do this without extra space.
分析:
该题目来源于leetcode。回文串是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。当然整数形式的回文串也是类似的。但负数不是回文串。两种思路:
按定义来,依次比较串的首尾,直到中...
分类:
其他好文 时间:
2014-12-21 20:43:45
阅读次数:
174
题目
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
B...
分类:
其他好文 时间:
2014-12-18 17:01:17
阅读次数:
187
isinstance说明如下: isinstance(object, class-or-type-or-tuple) -> bool Return whether an object is an instance of a class or of a subclass thereof. With a...
分类:
其他好文 时间:
2014-12-18 16:40:09
阅读次数:
196
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
But the following...
分类:
其他好文 时间:
2014-12-16 22:39:34
阅读次数:
214
Determine whether an integer is a palindrome. Do this without extra space.
思路:想办法把第一个和最后一个数字剥离出来比较
#include
int isPalindrome(int x){
int d=x/10,i=1;
int begin=0,end=0;
if(x<0) return 0...
分类:
其他好文 时间:
2014-12-15 17:22:08
阅读次数:
121
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of convertin...
分类:
其他好文 时间:
2014-12-15 09:03:15
阅读次数:
154
--配置oracle最大打开文件数限制
Solaris操作系统具有打开文件数量的限制,数据库的db_files参数设置会受操作系统的参数限制。
Soft Limit: maximum open file descriptors - This is a prerequisite condition to test whether the soft limit for "maximum open file descriptors" is set correctly.
Expected Value : 1024
...
分类:
数据库 时间:
2014-12-14 15:53:34
阅读次数:
579
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-12-14 00:43:17
阅读次数:
170
问题描述:
Determine whether an integer is a palindrome. Do this without extra space.
基本思路:
考虑到回文的特点,根据给定数字获得与给定数字低位高位反序的数字。如果是回文数,则两数想等;否则不等。(即使反序数字溢出,也可的到正确结果)
代码:
bool isPalindrome(int x) { //...
分类:
其他好文 时间:
2014-12-04 20:04:19
阅读次数:
159
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:
其他好文 时间:
2014-12-03 23:00:53
阅读次数:
290