Given two strings, find the longest string which is contained within both strings.

e.g. the longest string that is contained in the words 'banana' and 'anagram' is 'ana'

If there is no match, return an empty string.

Solution Stats

190 Solutions

59 Solvers

Last Solution submitted on Mar 14, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers59

Suggested Problems

More from this Author5

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!