Search⌘ K
AI Features

Index Pairs of a String

Understand how to use a Trie to identify all index pairs of substrings in a given string that appear in a unique list of words. Learn to return these pairs sorted by their start and end indices, helping you solve string matching problems efficiently.

Statement

Given a string text and an array of strings words, return a list of all index pairs [i, j] such that the substring text[i...j] is present in words.

Return the pairs [i, j] in a sorted order, first by the value of i, and if two pairs have the same i, by the value of j.

Constraints:

  • 11 \leq ...