Company: Visa_10june
Difficulty: medium
Longest Common Prefix Between Two Arrays of Numbers Problem Description Given two arrays of numbers, firstArray and secondArray . Return the length of the longest common prefix (LCP) between any pair of numbers from different arrays or 0 if no common prefix exists. Note: A prefix of a number is a number formed by one or more of its digits, starting from its highest-order digit. For example, 123 is a prefix of the number 12345 and 2 is a prefix of the number 234 . A common prefix of two numbers is a number which is a prefix of both. For instance, longest common prefix (LCP) of 565359 and 565354 is 56535 and there is no common prefix of 123 and 456 . Examples Example 1: Input: firstArray = [25, 288, 2655, 544, 54, 555], secondArray = [2, 255, 266, 244, 26, 5, 54544] Output: 4 Explanation: The best pair is 544 from the firstArray and 54544 from the secondArray with the LCP 5454 , where 5454 is of length 4 . Example 2: Input: firstArray = [25, 288, 2655, 544, 54, 555], secondArray = [2, 25