Partitioning Into Minimum Number Of Deci-Binary Numbers

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.
A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not.
Given a string n that represents a positive decimal integer, return the minimum number of positive deci-binary numbers needed so that they sum up to n.
LeetCode Problem - 1689
class Solution {
// Method to find the minimum number of partitions needed
public int minPartitions(String n) {
// Call the method to find the highest digit in the number
return findHighestValue(n);
}
// Method to find the highest digit in a number
public static int findHighestValue(String str){
// Convert the string to a character array
char[] strArray = str.toCharArray();
// Initialize the highest value with the first digit
int highestValue = Character.getNumericValue(strArray[0]);
// Iterate through the digits of the number
for (int i = 1; i < strArray.length; i++) {
// Get the numeric value of the current digit
int presentValue = Character.getNumericValue(strArray[i]);
// If the current digit is greater than the highest value, update the highest value
if (presentValue > highestValue) {
highestValue = presentValue;
}
// If the highest value is 9, no need to check further digits, break the loop
if (highestValue == 9) {
break;
}
}
// Return the highest value found
return highestValue;
}
}




