The solution commentary [1] doesn't mention DP.
[1]: https://techdevguide.withgoogle.com/resources/find-longest-w...