← ALL NOTES
Math

1071. Greatest Common Divisor of Strings

A string t "divides" s if s is t repeated a whole number of times; find the largest string that divides both str1 and str2 (empty if none). There's a beautiful two-line solution resting on one…

Loading…