Swift | Functional Approach
Functional Approach (accepted answer)\n\nclass Solution {\n    func maxDivScore(_ nums: [Int], _ divisors: [Int]) -> Int {\n        divisors.reduce((maxScore: -
**Functional Approach (accepted answer)**\n```\nclass Solution {\n    func maxDivScore(_ nums: [Int], _ divisors: [Int]) -> Int {\n        divisors.reduce((maxScore: -1, minDivisor: 0)) { result, divisor in\n            let score = nums.reduce(0) { score, num in score + (num % divisor == 0 ? 1: 0) }\n            let update = score > result.maxScore || (score == result.maxScore && divisor < result.minDivisor)\n            return update ? (maxScore: score, minDivisor: divisor) : result\n        }.minDivisor\n    }\n}\n```
['Swift']