题目描述
1 |
Write a program to check whether a given number is an ugly number. |
解题思路
- 判断n是否能被2,3,5整除,如果不可以直接返回false
- 如果可以将n替换为n/[2,3,5]后,再进行判断
Go实现1
1 |
func (num int) bool { |
Go实现2
1 |
func (num int) bool { |
1 |
Write a program to check whether a given number is an ugly number. |
1 |
func (num int) bool { |
1 |
func (num int) bool { |
近期评论