Greatest Common Divisor of Strings
Easy · Math & Number Theory · about 10 minutes
Asked at Google, Microsoft, Amazon.
String t divides string s if s is t repeated one or more times. Given str1 and str2, return the largest string that divides both, or "" if none exists.