Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

Given a list of documents, each with a unique document ID and associated text. Implement a system that allows efficient searching of phrases within these documents. The search is case-insensitive and the system should be capable of handling searching over one million documents.

Implement the DocumentLibrary class:

  • DocumentLibrary(List<List<String>> documents) Initialize a document library with a list of document IDs and text.
  • List<String> search(String phrase) Find all document IDs that contain the phrase (case-insensitive).
Test Cases
Input
Output
Expected