Plus One

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 a large integer represented as an integer array digits, where each digits[i] is the i<sup>th</sup> digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's.
Increment the large integer by one and return the resulting array of digits.
LeetCode Problem: Link | Click Here
class Solution {
public int[] plusOne(int[] digits) {
// Loop through the digits starting from the last one
for (int i = digits.length - 1; i >= 0; i--) {
// If the digit is less than 9, add 1 to it
if (digits[i] < 9) {
digits[i]++; // Increase the digit by 1
return digits; // Return the updated number
}
// If the digit is 9, set it to 0 and go to the previous digit
digits[i] = 0;
}
// If all digits were 9, make a new array with one more digit and set the first digit to 1
digits = new int[digits.length + 1];
digits[0] = 1; // Set the first digit to 1 (for carry-over)
return digits; // Return the updated number
}
}




