💡Swift - Optimal Solution - Backtracking
Solution\n\nclass Solution {\n    func maxLength(_ arr: [String]) -> Int {\n        // Filter out strings with repeated characters as we can never use them.\n  
# Solution\n```\nclass Solution {\n    func maxLength(_ arr: [String]) -> Int {\n        // Filter out strings with repeated characters as we can never use them.\n        let sets: [Set<Character>] = arr.compactMap {\n            let characterSet = Set($0)\n            return $0.count == characterSet.count ? characterSet : nil\n        }\n\n        func backtrack(_ start: Int, _ seen: Set<Character>) -> Int {\n            var result = 0\n            for i in start..<sets.count where seen.intersection(sets[i]).isEmpty {\n                result = max(result, sets[i].count + backtrack(i + 1, seen.union(sets[i])))\n            }\n            return result\n        }\n\n        return backtrack(0, [])\n    }\n}\n```\n# Complexity\n- Time: $$O(2^n)$$\n- Space: $$O(n)$$
['Backtracking', 'Swift']