FastPrepFind Length of Longest Common Prefix

Find Length of Longest Common Prefix

Uber logoUber● EasyOA
Learn

Problem statement

Given two arrays of strictly integers, arr1 and arr2, find the length of the longest common prefix of any pair of numbers from the two arrays.

Function

findLengthOfLongestCommonPrefix(arr1: int[], arr2: int[]) → int

Examples

Example 1

arr1 = [123, 4, 5, 955]arr2 = [12345, 63, 95, 2]return = 3

n/a 🥲

Constraints

  • n/a 🥹

More Uber problems

See Uber hiring insights
public int findLengthOfLongestCommonPrefix(int[] arr1, int[] arr2) {
  // write your code here (pps:) you may want to refer to lc 3043)
}
arr1[123, 4, 5, 955]
arr2[12345, 63, 95, 2]
expected3
Checking account…