I made a video discussing various approaches to problem E. A Trivial String Problem from the last Div 2 round (1087). It has optimizations from $$$O(N^4 \cdot Q)$$$ to $$$O(N^3 \cdot Q)$$$ to $$$O(N^2 \cdot Q)$$$ to $$$O(N \cdot Log(N) \cdot Q)$$$
P.S: It does not discuss the $$$O(N \cdot Q)$$$ solution.
Video Link : https://youtu.be/RyLntKofg8k







