Smallest Divisible Digit Product I

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.
You are given two integers n and t. Return the smallest number greater than or equal to n such that the product of its digits is divisible by t.
LeetCode Problem - 3345
class Solution {
public int smallestNumber(int n, int t) {
// Early exit for the case when t = 1
if (t == 1) return n;
while (true) {
int prodOfN = findProdOfDigit(n);
if (prodOfN % t == 0) {
break;
}
n++;
}
return n;
}
public int findProdOfDigit(int num) {
int result = 1;
// If the number contains a zero, the product will be zero
while (num != 0) {
int digit = num % 10;
if (digit == 0) return 0; // early exit if any digit is zero
result *= digit;
num /= 10;
}
return result;
}
}




