Python solution


  • 1
    def splitLoopedString(self, strs):
            strs = [max(s, s[::-1]) for s in strs]
            res = ""
            for i, s in enumerate(strs):
                for j in range(len(s)):
                    words = ''.join(strs[i + 1:] + strs[:i])
                    res = max(res, s[j:] + words + s[:j], s[j::-1] + words + s[:j:-1])
            return res

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.