Ugly Number

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.
Given an integer n, return true if n is an ugly number.
LeetCode Problem - 263
class Solution {
public boolean isUgly(int n) {
// If the number is less than 1, it's not considered ugly.
if (n < 1) return false;
// Divide the number by 2 until it's no longer divisible by 2.
while (n % 2 == 0) {
n /= 2;
}
// Divide the number by 3 until it's no longer divisible by 3.
while (n % 3 == 0) {
n /= 3;
}
// Divide the number by 5 until it's no longer divisible by 5.
while (n % 5 == 0) {
n /= 5;
}
// If the number becomes 1 after dividing by 2, 3, and 5, it means it's an ugly number, otherwise not.
return n == 1;
}
}




