当前位置:网站首页>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

边栏推荐
- leetcode:297. Serialization and deserialization of binary tree
- Null and undefined
- JMeter starts from zero (III) -- simple use of regular expressions
- 【学习笔记】seckill-秒杀项目--(11)项目总结
- SAP UI5 应用开发教程之一百零五 - SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍
- 105. SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍
- vim 的实用操作
- 【刷题篇】 找出第 K 小的数对距离
- Introduction to eth
- [Yu Yue education] reference materials of political communication science of Communication University of China
猜你喜欢

2022 tea master (primary) examination questions and tea master (primary) examination question bank

CEPH Shangwen network xUP Nange that releases the power of data

2022 Shandong Province safety officer C certificate examination questions and Shandong Province safety officer C certificate simulation examination question bank

What can learning pytorch do?

竞品分析撰写

China Mobile Internet of things oneos and onenet were selected in the list of 2021 Internet of things demonstration projects

105. SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍

IPv6过渡技术-6to4手工隧道配置实验--尚文网络奎哥

Ffmpeg download and installation tutorial and introduction

【毕业季·进击的技术er】职场人的自白
随机推荐
『期末复习』16/32位微处理器(8086)基本寄存器
Esp32 series (3): GPIO learning (take simple GPIO input and output, ADC, DAC as examples)
Social phobia of contemporary young people (III)
Supervised pre training! Another exploration of text generation!
Taking two column waterfall flow as an example, how should we build an array of each column
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
Simple wechat applet development page Jump, data binding, obtaining user information, obtaining user location information
pytorch怎么下载?pytorch在哪里下载?
2022 P cylinder filling examination content and P cylinder filling practice examination video
阿洛对自己的思考
【毕业季·进击的技术er】职场人的自白
[brush questions] most elements (super water king problem)
中移物联网OneOS与OneNET入选《2021年物联网示范项目名单》
Social phobia of contemporary young people (II)
Basic MySQL operations
In Net 6 project using startup cs
Separable bonds and convertible bonds
CVPR 2022 | 大連理工提出自校准照明框架,用於現實場景的微光圖像增强
Is pytorch open source?
Appium automated testing framework