Maximum Common Decimal Prefix Across Arrays
Updated
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
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Count Suffix Word PairsTikTok · OATikTok interview questions
- Count One-Swap Number PairsCapital One · OACapital One interview questions
- Maximum Equal Parts for PrefixesAmazon · OA
- Cheating CodemakerJane Street · OAJane Street interview questions
- Count Pairs Differing in One DigitRoblox · OARoblox interview questions
- Candidate Alias Name MatchingCheckr · OA · PHONE SCREEN
- Aggregate Paginated Project Run RecordsReplit · OA
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA
- Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions