Sequential String

Problem Overview

  • Compute, for each query in arr, the minimum characters from digit-only s (sequential access) needed to contain any permutation of that query, or -1 if impossible.
  • Input: s of '0'-'9' and arr of digit strings; Output: int array with minimal substring length in s per query.
  • Constraints: n ≤ 1e5, up to 2e4 queries, total query length ≤ 5e5.
  • From Snowflake interviews: string processing problem common in coding interview prep and interview question sets.

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: