Largest Lexicographical Substring

Problem Overview

  • Find the lexicographically largest substring of B that is a superstring of A (contains all characters of A, order ignored); if none exists, return -1.
  • Input: two strings A and B; Output: the qualifying substring or -1; constraints unspecified.
  • Relevant to string processing and text validation where coverage of required characters within a substring matters.
  • This coding interview problem is known from Google interviews and is a common 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: