FastPrepMaximum Common Decimal Prefix Across Arrays
Problems/Maximum Common Decimal Prefix Across Arrays

Maximum Common Decimal Prefix Across Arrays

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes positive integers, ordinary decimal prefixes taken from one value of each array, the maximum length, and a worked example. We supplied limits and a function signature.

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[]) → int

Examples

Example 1

first = [12345,9012]second = [12222,1,123902]return = 3

12345 and 123902 share prefix 123, of length three.

Example 2

first = [7,80]second = [6,90]return = 0

No cross-array pair starts with the same digit.

Constraints

  • 1 <= first.length,second.length <= 100000
  • 1 <= 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

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int maximumCommonDecimalPrefix(int[] first, int[] second) {
        // Write your code here.
    }

}
Checking account…