Find P-Matching Score

Problem Overview

  • Compute the p-matching score: the max count of start indices i in userID1 where the length-|userID2|, step-p character sequence can be rearranged to userID2.
  • Inputs: userID1, userID2 (lowercase), and integer p; Output: an integer score.
  • Constraints: 1 ≤ |userID2| ≤ |userID1| ≤ 1e6, 1 ≤ p ≤ 1e6.
  • Real-world context: comparing Amazon customer usernames; an Amazon coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: