Search
⌘K

Leetcode 3043. Find the Length of the Longest Common Prefix

Given two arrays of positive integers, return the maximum length (in digits) of a common leftmost-digit prefix shared by any number from arr1 and any number from arr2, or 0 if none exists. The core task is efficiently comparing digit-prefixes across up to 5e4 numbers (digits ≤9), e.g., by converting to strings and using prefix sets, tries, or hashing to find the longest intersecting prefix.

Asked at:

Apple


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid September, 2024

Apple

Senior

Longest common prefix

Comments

Your account is free and you can post anonymously if you choose.