From c8cd9298028e3a0631fc1aea3cfd2eed631ed964 Mon Sep 17 00:00:00 2001 From: jaydev Date: Mon, 24 Nov 2025 12:20:56 +0530 Subject: [PATCH] Enhance comments in isUgly function Added comments to clarify the logic for checking ugly numbers. --- 0263-ugly-number/0263-ugly-number.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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