A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

3位数的话,就从999开始,为了减少遍历次数,就先从999-900,如果没有条件满足,再放大这个范围

l = []
for i in range(999, 900, -1):
for j in range(999, 900, -1):
n = str(i * j)
if n == n[::-1]:
l.append(int(n))
print(max(l))

执行结果:906609

Problem 4: Largest palindrome product的更多相关文章

  1. 【欧拉计划4】Largest palindrome product

    欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/1371281760.html 原创:[欧 ...

  2. (Problem 4)Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  3. Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  4. 欧拉计划之Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  5. [LeetCode] Largest Palindrome Product 最大回文串乘积

    Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...

  6. 【easy】479. Largest Palindrome Product

    Find the largest palindrome made from the product of two n-digit numbers Since the result could be v ...

  7. [Swift]LeetCode479. 最大回文数乘积 | Largest Palindrome Product

    Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...

  8. LeetCode Largest Palindrome Product

    原题链接在这里:https://leetcode.com/problems/largest-palindrome-product/description/ 题目: Find the largest p ...

  9. 【LeetCode】479. Largest Palindrome Product 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

随机推荐

  1. [mysql]You must reset your password using ALTER USER statement before executing this statement.

    原因分析: MySQL版本5.6.6版本起,添加了password_expired功能,它允许设置用户的过期时间.这个特性已经添加到mysql.user数据表,但是它的默认值是”N”,可以使用ALTE ...

  2. Git初识学习

    初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 使用命令git add <file>,注意,可反复多次使用,添加多个文件: 使用命令git commit ...

  3. 使用VSCode调试Jest

    0. 环境 Node版本:8.12.0 操作系统:windows10 1. 配置launch.json { "version": "0.2.0", " ...

  4. React---简单实现表单点击提交插入、删除操作

    import React,{Component,Fragment} from 'react' class App extends Component { constructor(){ super() ...

  5. java笔记 -- 输入输出

    读取输入: 如果想通过控制台进行输入, 首先需要构造一个Scanner对象.并与'标准输入流'System.in关联. 代码见下文代码块. Sanner (InputStream in) 用给定的输入 ...

  6. DAY 30 网络编程基础

    一.软件开发架构 1.c/s架构 c:客户端 s:服务端 2.b/s架构 b:浏览器 c:服务器 手机端:好像C/S架构比较火,其实不然,微信小程序.支付宝第三方接口 B/S架构的优点是统一接口 PC ...

  7. bs4 FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

    安装beautifulsoup后,运行测试报错 from urllib import requestfrom bs4 import BeautifulSoup url = "http://w ...

  8. 【改】利用ALSA库进行音频重采样

    转自:http://www.voidcn.com/article/p-snamarwr-p.html 一.ALSA介绍: 1.简介: 高级Linux声音体系(英语:Advanced LinuxSoun ...

  9. Flex4之皮肤定制

    Flex4之皮肤定制[Skin类和Skin类]          博客分类: RIA-Flex4专栏 FlexAdobeUPFlashUI 第一.关于spark.skin.SparkSkin类的 1. ...

  10. CF923E Perpetual Subtraction

    生成函数好题! 搬一手铃悬的题解(侵删) 现在只需要考虑怎么求出g和逆变换即可,其实也就是对函数F(x)求F(x+1)和F(x-1). 直接二项式定理展开发现是个卷积的形式,大力NTT即可. #inc ...