1.编辑器

我使用的是win10+vscode+leetcode+python3
环境配置参见我的博客:
链接

2.第一百七十二题

(1)题目
英文:
Given an integer n, return the number of trailing zeroes in n!.

中文:
给定一个整数 n,返回 n! 结果尾数中零的数量。

来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/majority-element

(2)解法
记录阶乘有多少个5的因子即可,因为每两个因子就会出现一个含2的因子,而每5个因子就会出现一个含5的因子,所以只要能出现含5的因子就能找到相应的2与之配对,产生0。
(耗时:40ms,内存:13.7M)

class Solution:def trailingZeroes(self, n: int) -> int:p = 0 while n >= 5: n = n // 5 p += n return p

leetcode python3 简单题172. Factorial Trailing Zeroes相关推荐

  1. LeetCode 172. Factorial Trailing Zeroes

    LeetCode 172. Factorial Trailing Zeroes 问题来源LeetCode 172. Factorial Trailing Zeroes 问题描述 Given an in ...

  2. 172. Factorial Trailing Zeroes

    /**172. Factorial Trailing Zeroes *2016-6-4 by Mingyang* 首先别忘了什么是factorial,就是阶乘.那么很容易想到需要统计* (2,5)对的 ...

  3. LeetCode(172) Factorial Trailing Zeroes

    题目如下: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be ...

  4. 【LeetCode】172 - Factorial Trailing Zeroes

    Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...

  5. Leetcode 172 Factorial Trailing Zeroes

    1.题目要求 Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be ...

  6. leetcode python3 简单题225. Implement Stack using Queues

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第二百二十五题 (1)题目 英文: Implement the following ...

  7. leetcode python3 简单题70. Climbing Stairs

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第七十题 (1)题目 英文: You are climbing a stair ca ...

  8. leetcode python3 简单题69. Sqrt(x)

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第六十九题 (1)题目 英文: Implement int sqrt(int x). ...

  9. leetcode python3 简单题53. Maximum Subarray

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第五十三题 (1)题目 英文: Given an integer array num ...

最新文章

  1. ubuntu 12.04 3D特效
  2. 关于算法—— 一维字符串数组之间组合问题的C#实现
  3. HDR概念 (二十八)
  4. HTML和小程序的 12 种 flex 布局
  5. FixedLengthFrameDecoder 固定长度解码器,解决 TCP 粘包
  6. MCGS 昆仑通态触摸屏 modbus TCP 数据转发
  7. 安装windows server2008虚拟机
  8. 前端vue经典面试题78道(重点详细简洁)
  9. 电脑系统更新完后,计算机管理服务中找不到mysql的服务
  10. kindle paperwhite2 越狱备忘
  11. 1.JS高级红宝书程序设计之JS的嵌入方式
  12. 红旗Linux网卡Bind,请教一下在红旗linux中安装网卡RTL8168/8111的问题
  13. php liger 表格排序,LigerUI之grid表格点击表头标题排序实现
  14. 【学习笔记】builtin函数
  15. 空口定义、下行传输流程
  16. 哈尔滨工业大学博士覃立波:多领域端到端任务型对话系统研究分享
  17. Sox语音转换的相关知识
  18. java开发社交网站_(转)强烈推荐:著名社交网站LinkedIn的Java架构技术
  19. 立体匹配——引导滤波
  20. windows系统日志查看

热门文章

  1. mysql 进阶到高级_MySQL 高级(进阶) SQL 语句精讲(一)
  2. java 根据星期计算日期_Java 根据指定日期计算所在周的周一和周日
  3. 第3个项目实操:用类与对象的方法编程
  4. string的operate+=
  5. JupyterLab的安装笔记
  6. hihocoder第229周:最大连续字母个数
  7. 理解Lucene中的Analyzer
  8. Norton ConnectSafe,DNS策略防止误入钓鱼网站(Norton Security)
  9. 如何在其他类中使用application.properties的属性
  10. MD5之C#密码加密-备忘录