Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The task of the sameEnds challenge on Codingbat is to write a function that takes a string as input and returns the longest substring that appears at both ends of the string without overlapping. For example, if the input string is "abXYZba", the function should return "ab". If there is no such substring, the function should return an empty string.