Form Smallest Number From Two Digit Arrays

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.
Given two arrays of unique digits nums1 and nums2, return thesmallestnumber that containsat leastone digit from each array.
LeetCode Problem - 2605
class Solution {
public int minNumber(int[] nums1, int[] nums2) {
// Sort both arrays to ensure elements are in ascending order
Arrays.sort(nums1);
Arrays.sort(nums2);
// Iterate through both arrays to find a common element
for (int i = 0; i < nums1.length; i++) {
for (int j = 0; j < nums2.length; j++) {
// If a common element is found, return it immediately
if (nums1[i] == nums2[j]) return nums2[j];
}
}
// If no common element is found, create two possible numbers
// by combining the smallest elements from both arrays in different orders
int type1 = Integer.parseInt(nums1[0] + "" + nums2[0]);
int type2 = Integer.parseInt(nums2[0] + "" + nums1[0]);
// Return the smaller of the two possible numbers
return Math.min(type1, type2);
}
}




