First Index of an Anagram Substring

Asked at Databricks · Coding Questions · Difficulty: Easy

Given a text string `s` and a query string `p`, find the **first index** in `s` where a substring that is an anagram (any permutation) of `p` begins. Return `-1` if none exists.

Loading the problem…