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.
Examples
01 · Example 1
arr1 = [123, 4, 5, 955] arr2 = [12345, 63, 95, 2] return = 3
n/a 🥲
Constraints
n/a 🥹More Uber problems
- Jump Game with Prime-3 StepsOA · Seen Jun 2026
- Total Palindrome Substring CostOA · Seen Jun 2026
- Earliest Time All Users Are ConnectedPHONE SCREEN · Seen May 2026
- Tournament Rounds by RankPHONE SCREEN · Seen May 2026
- Farthest Seat AssignmentONSITE INTERVIEW · Seen May 2026
- Convex Function MinimizationPHONE SCREEN · Seen May 2026
- Maximal Square AreaONSITE INTERVIEW · Seen May 2026
- First Unique IP Hitting the ServerPHONE SCREEN · Seen May 2026
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
sign in to submit