Try all substrings of s. For each, check if it contains all characters of t.
There are substrings. Checking each against t takes comparisons. Total: .
For , that's operations. Far too slow.
The trap
Try all substrings of s. For each, check if it contains all characters of t.
There are substrings. Checking each against t takes comparisons. Total: .
For , that's operations. Far too slow.