当前位置:网站首页>Daily question - ugly number
Daily question - ugly number
2022-07-03 04:05:00 【々 orange if ℃ №】
Learning goals :
A daily topic - Ugly number
source : Power button (LeetCode)
link :https://leetcode-cn.com/problems/ugly-number
Copyright belongs to the network . For commercial reprint, please contact the official authority , Non-commercial reprint please indicate the source .
Learning content :
Give you an integer n , Please judge n Is it Ugly number . If it is , return true ; otherwise , return false .
Ugly number That is, only the prime factor is included 2、3 and / or 5 The positive integer .
solution :
class Solution:
def isUgly(self, n: int) -> bool:
if n<= 0:
return False
for item in [2,3,5]:
while n % item == 0:
n//=item
return n == 1
边栏推荐
- 300+篇文献!一文详解基于Transformer的多模态学习最新进展
- 【刷题篇】接雨水(一维)
- IPv6 transition technology-6to4 manual tunnel configuration experiment -- Kuige of Shangwen network
- Write it down once Net travel management background CPU Explosion Analysis
- 『期末复习』16/32位微处理器(8086)基本寄存器
- The latest analysis of the main principals of hazardous chemical business units in 2022 and the simulated examination questions of the main principals of hazardous chemical business units
- 105. Detailed introduction of linkage effect realization of SAP ui5 master detail layout mode
- leetcode:297. Serialization and deserialization of binary tree
- Message queue addition failure
- [set theory] set concept and relationship (set represents | number set | set relationship | contains | equality | set relationship property)
猜你喜欢
2022 tea master (primary) examination questions and tea master (primary) examination question bank
pytorch难学吗?如何学好pytorch?
When writing a web project, SmartUpload is used for file upload and new string () is used for transcoding, but in the database, there will still be random codes similar to poker
Interaction free shell programming
Mutex and rwmutex in golang
Makefile demo
Simple wechat applet development page Jump, data binding, obtaining user information, obtaining user location information
300+篇文献!一文详解基于Transformer的多模态学习最新进展
Wechat applet + Alibaba IOT platform + Hezhou air724ug built with server version system analysis
2022 P cylinder filling examination content and P cylinder filling practice examination video
随机推荐
记一次 .NET 差旅管理后台 CPU 爆高分析
[Apple Photo Album push] IMessage group anchor local push
How does the pytorch project run?
js实现在可视区内,文字图片动画效果
[Blue Bridge Road -- bug free code] interpretation of some codes of matrix keyboard
在 .NET 6 项目中使用 Startup.cs
Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
Interaction free shell programming
Interface embedded in golang struct
因果AI,下一代可信AI的产业升级新范式?
China Mobile Internet of things oneos and onenet were selected in the list of 2021 Internet of things demonstration projects
[learning notes] seckill - seckill project - (11) project summary
How to download pytorch? Where can I download pytorch?
以两列的瀑布流为例,我们应该怎么构建每一列的数组
[mathematical logic] propositional logic (equivalent calculus | idempotent law | exchange law | combination law | distribution law | De Morgan law | absorption rate | zero law | identity | exclusion l
NPM: the 'NPM' item cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Please check the spelling of the name. If the path is included, make sure the path is corr
Causal AI, a new paradigm for industrial upgrading of the next generation of credible AI?
Bisher - based on SSM pet adoption center
2022 P cylinder filling examination content and P cylinder filling practice examination video
[home push IMessage] software installation virtual host rental tothebuddy delay