Maximum Common Decimal Prefix Across Arrays
Problem statement
You are given two arrays of positive integers, first and second.
Choose one value from each array and compare their ordinary decimal representations. Return the maximum common-prefix length over every cross-array pair.
Function
maximumCommonDecimalPrefix(first: int[], second: int[]) → intExamples
Example 1
first = [12345,9012]second = [12222,1,123902]return = 312345 and 123902 share prefix 123, of length three.
Example 2
first = [7,80]second = [6,90]return = 0No cross-array pair starts with the same digit.
Constraints
1 <= first.length,second.length <= 1000001 <= value <= 1000000000