Palindrome 回文数
回文数,从前到后,从后到前都一样
把数字转成字符串来处理
package com.rust.cal;
public class Palindrome {
public static boolean isPalindrome(int x) {
String s = String.valueOf(x);
String revers = new StringBuffer(s).reverse().toString();
if (s.equalsIgnoreCase(revers)) {
return true;
}
return false;
}
public static void main(String arg[]){
int input = 123;
if (isPalindrome(input)) {
System.out.println("Yes");
} else {
System.out.println("NO");
}
}
}
Palindrome 回文数的更多相关文章
- leetcode4 Valid Palindrome回文数
Valid Palindrome回文数 whowhoha@outlook.com Question: Given a string, determine if it is a palindrome, ...
- 有趣的数-回文数(Palindrome number)
文章转自http://blog.163.com/hljmdjlln@126/blog/static/5473620620120412525181/ 做LC上的题"Palindrome num ...
- Leetcode 3——Palindrome Number(回文数)
Problem: Determine whether an integer is a palindrome. Do this without extra space. 简单的回文数,大一肯定有要求写过 ...
- leetcode 9 Palindrome Number 回文数
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...
- palindrome number(回文数)
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negativ ...
- [LeetCode] Prime Palindrome 质数回文数
Find the smallest prime palindrome greater than or equal to N. Recall that a number is prime if it's ...
- [Swift]LeetCode9. 回文数 | Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...
- [Swift]LeetCode479. 最大回文数乘积 | Largest Palindrome Product
Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...
- [Swift]LeetCode564. 寻找最近的回文数 | Find the Closest Palindrome
Given an integer n, find the closest integer (not including itself), which is a palindrome. The 'clo ...
随机推荐
- Android控件的使用
1. RadioButton (单选按钮) 嵌入到RadioGroup中实现单选效果 android:checkedButton="radio的id值" int getchecke ...
- 深入探索C++对象模型(六)
执行期语意学(Runtime Semantics) 对象的构造和析构(Object Constructor and Destructor) 一般而言,constructor和destructor的安插 ...
- spring quartz开发中使用demo
1.首先在pom.xml中配置quartz的jar: <!--定时器--> <dependency> <groupId>org.quartz-scheduler&l ...
- 【论文:麦克风阵列增强】Speech Enhancement Based on the General Transfer Function GSC and Postfiltering
作者:桂. 时间:2017-06-06 16:10:47 链接:http://www.cnblogs.com/xingshansi/p/6951494.html 原文链接:http://pan.ba ...
- C# ftp 图片上传多快好省
前言 此篇讲到的是图片上传功能,每个网站必定会有这样类似的功能,上传文件.上传图片等等.那么接下来,看看我们EF+uploadfile+ftp如何玩转上传图片吧 效果预览 具体实现 一个简单数据库 只 ...
- 文件描述符与FILE
1. 文件描述符(重点) 在Linux系统中一切皆可以看成是文件,文件又可分为:普通文件.目录文件.链接文件和设备文件.文件描述符(file descriptor)是内核为了高效管理已被打开的文件所创 ...
- scrapy抓取淘宝女郎
scrapy抓取淘宝女郎 准备工作 首先在淘宝女郎的首页这里查看,当然想要爬取更多的话,当然这里要查看翻页的url,不过这操蛋的地方就是这里的翻页是使用javascript加载的,这个就有点尴尬了,找 ...
- 腾讯AlloyTeam正式发布pasition - 制作酷炫Path过渡动画
pasition Pasition - Path Transition with little JS code, render to anywhere - 超小尺寸的Path过渡动画类库 Github ...
- An express train to reveries
An express train to reveries time limit per test 1 second memory limit per test 256 megabytes input ...
- 愚公oracle数据库同步工具
最近,利用一些时间对oracle数据库实时同步工具做了一些调研分析,主要关注了linkedin的databus和阿里的yugong两个中间件,其中databus需要在每个待同步的表上增加额外的列和触发 ...