I think that’s not called “problem solved” in any serious company, Google included.

Even if you get this problem on some coding platform, your solution will fail on the performance part.

What would really help is to mention something like Boyer-Moore algorithm in the end, for example.

Solutions Architect @Depop, author of “Hands-on Design Patterns with Kotlin” book and “Web Development with Kotlin” course

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store