mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-07 09:54:57 +08:00
fix 263: remove redundant compute
This commit is contained in:
@ -1,10 +1,12 @@
|
|||||||
package leetcode
|
package leetcode
|
||||||
|
|
||||||
func isUgly(num int) bool {
|
func isUgly(num int) bool {
|
||||||
for i := 2; i < 6 && num > 0; i++ {
|
if num > 0 {
|
||||||
|
for _, i := range []int{2, 3, 5} {
|
||||||
for num%i == 0 {
|
for num%i == 0 {
|
||||||
num /= i
|
num /= i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return num == 1
|
return num == 1
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user