Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix 263: remove redundant compute
  • Loading branch information
novahe committed Apr 30, 2021
commit 594af3f4d890006e17bfbeb3ad8f8a03101e8ea5
8 changes: 5 additions & 3 deletions leetcode/0263.Ugly-Number/263. Ugly Number.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package leetcode

func isUgly(num int) bool {
for i := 2; i < 6 && num > 0; i++ {
for num%i == 0 {
num /= i
if num > 0 {
for _, i := range []int{2, 3, 5} {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

for num%i == 0 {
num /= i
}
}
}
return num == 1
Expand Down