Ez brute force again || C++ || Java || Python
Intuition\nJust count the number of divisors for each divisors[i] in nums array. Since the constraints are low, TC: O(mn) is feasible solution.\n\n\n# Complexit
# Intuition\nJust count the number of divisors for each divisors[i] in nums array. Since the constraints are low, TC: O(m*n) is feasible solution.\n\n\n# Complexity\n- Time complexity:\nO(M*N)\n\n\n# Code\n```C++ []\nclass Solution {\npublic:\n    int maxDivScore(vector<int>& nums, vector<int>& divisors)\n    {\n        int d = divisors.size();\n        vector<int> res(d,0);\n        int maxDiv = 0;\n        for(int i=0; i<d; i++)\n        {\n            int div = divisors[i];\n            for(auto x : nums)\n            {\n                if(x%div == 0){\n                    res[i]++;\n                }\n            }\n            maxDiv = max(maxDiv, res[i]);\n        }\n        \n        int ans = INT_MAX;\n        for(int i=0; i<d; i++)\n        {\n            if(res[i] == maxDiv){\n                ans = min(ans, divisors[i]);\n            }\n        }\n        return ans;\n    }\n};\n```\n```Java []\nclass Solution {\n    public int maxDivScore(int[] nums, int[] divisors) {\n        int d = divisors.length;\n        int[] res = new int[d];\n        int maxDiv = 0;\n        for(int i=0; i<d; i++) {\n            int div = divisors[i];\n            for(int x : nums) {\n                if(x % div == 0) {\n                    res[i]++;\n                }\n            }\n            maxDiv = Math.max(maxDiv, res[i]);\n        }\n\n        int ans = Integer.MAX_VALUE;\n        for(int i=0; i<d; i++) {\n            if(res[i] == maxDiv) {\n                ans = Math.min(ans, divisors[i]);\n            }\n        }\n        return ans;\n    }\n}\n```\n```Python []\nclass Solution:\n    def maxDivScore(self, nums: List[int], divisors: List[int]) -> int:\n        d = len(divisors)\n        res = [0] * d\n        maxDiv = 0\n        for i in range(d):\n            div = divisors[i]\n            for x in nums:\n                if x % div == 0:\n                    res[i] += 1\n            maxDiv = max(maxDiv, res[i])\n\n        ans = float(\'inf\')\n        for i in range(d):\n            if res[i] == maxDiv:\n                ans = min(ans, divisors[i])\n        return ans\n```
['C++', 'Java', 'Python3']