educative.io

O (n + m) solution

I understand that DP solution is helpful to understand/solve derived problems, but this problem has a suffix tree solution, which is way faster - O(n + m). It would be good if you mention that somewhere.

Sure. Will look into that.