Problems > Longest Border > Editorial

Longest Border — Solution & Editorial

Back to the Problem

This is exactly the last value of the KMP prefix function.

Complexity: O(|S|)