diff --git a/0263-ugly-number/0263-ugly-number.py b/0263-ugly-number/0263-ugly-number.py index 3899c206c..6def93c3b 100644 --- a/0263-ugly-number/0263-ugly-number.py +++ b/0263-ugly-number/0263-ugly-number.py @@ -2,9 +2,12 @@ class Solution: def isUgly(self, n: int) -> bool: + # Negative Values are not considerd as ugly numbers. if n <= 0: return False for p in [2, 3, 5]: + # An Ugly number is only divided with either 2 or 3 or 5 , to check that , iterated a loop through a fixed array . while n % p == 0: + # This while loop checks the divisibility of number . If satisfied , it divides the p by n , untill p is not divisible ny n anymore . This loop runs for every number in the array. n = n // p - - return n == 1 \ No newline at end of file + # finally it checks the conditoin , if n equall to one after performing division loop , the ugly number conditions are stasfied . + return n == 1