Index Pairs of a String

Easy · Trie · about 15 minutes

Asked at Amazon, Google, Meta.

Return every index pair [i, j] such that text[i..j] (inclusive) is one of words, sorted by i and then j.

Related guides