1,采用reverse的方法,来比较是不是palindrome2,reverse number的方法!!3,还要记得负数的情况package Leetcode;public class PalindromeNumber {public boolean isPalindrome(int x) { .....
分类:
其他好文 时间:
2014-10-26 08:00:01
阅读次数:
208
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Cl...
分类:
其他好文 时间:
2014-10-25 21:29:50
阅读次数:
236
#pragma warning(disable:4786)#include #include using namespace std ;typedef set SET_INT;int main() { SET_INT s1; SET_INT::reverse_iterator i; cout ...
分类:
编程语言 时间:
2014-10-25 17:12:28
阅读次数:
157
数字反转时间限制:1s 内存限制:128MB【问题描述】给定一个整数,请将该数各个位上数字反转得到一个新数。新数也应满足整数的常见形式,即除非给定的原数为零,否则反转后得到的新数的最高位数字不应为零(参见样例 2)。【输入】输入文件名为 reverse.in。输入共 1 行,一个整数 N。【输出】....
分类:
其他好文 时间:
2014-10-24 20:24:49
阅读次数:
790
逆转单向链表#include<stdio.h>
#include<stdlib.h>
structNode{
intdata;
structNode*next;
};
voidlist_reverse(structNode**head)
{
structNode*cur,*rev;
structNode*hold;
cur=*head;
rev=0;
while(cur){
hold=cur;
cur=cur->next;
hold->..
分类:
其他好文 时间:
2014-10-24 19:10:08
阅读次数:
208
逆转字符串#include<stdio.h>
#include<string.h>
char*reverse(char*str)
{
inti,j;
for(i=0,j=strlen(str)-1;i<j;++i,--j){
chartmp=str[i];
str[i]=str[j];
str[j]=tmp;
}
returnstr;
}
intmain()
{
charstr[100];
scanf("%s",str);
reverse(..
分类:
其他好文 时间:
2014-10-24 16:50:08
阅读次数:
177
#include<stdio.h>
#include<string.h>
char*reverse(char*str)
{
inti,j;
for(i=0,j=strlen(str)-1;i<j;++i,--j){
chartmp=str[i];
str[i]=str[j];
str[j]=tmp;
}
returnstr;
}
char*strsum(constchar*add1,constchar*add2,char*result)
{
inti,j,k;
intca..
分类:
其他好文 时间:
2014-10-24 16:48:48
阅读次数:
179
题目描述:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
思路:先判断给的数是正数还是负数还是零。如果是零,则直接返回。如果是正数,则通过%和/运算求得给定数字的各位,再重新组合得到要求得数字。如果为负数则先转换为正数,再按正数处理,最后返回...
分类:
其他好文 时间:
2014-10-24 16:42:21
阅读次数:
112
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:
其他好文 时间:
2014-10-24 14:33:58
阅读次数:
154
sorted(...)
Help on built-in function sorted in module __builtin__:
sorted(...)
sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list
sort(...)
Help on built-in function sor...
分类:
编程语言 时间:
2014-10-24 13:03:18
阅读次数:
202