Algorithm Explained: Determine if two strings have a substring in common

Problem statement: Given two strings, determine if they have a substring in common. Example: Do “hello world” and “world” have a substring in common? Yes, they both have the substring “world”. Approach What are all the substrings of string? The string “word” is four characters long. It contains 10 substrings between length 1 and 4. … Read more