C++ Brute Force Easy
\n# Code\n\nclass Solution {\npublic:\n    int maxDivScore(vector<int>& nums, vector<int>& divisors) {\n        int max_idx = 0;\n        int maxi = INT_MIN;\n 
\n# Code\n```\nclass Solution {\npublic:\n    int maxDivScore(vector<int>& nums, vector<int>& divisors) {\n        int max_idx = 0;\n        int maxi = INT_MIN;\n        for(int i = 0; i < divisors.size(); i++)\n        {\n            int count = 0;\n            for(int j = 0; j < nums.size(); j++)\n            {\n                if(nums[j] % divisors[i] == 0)\n                {\n                    count++;\n                }\n            }\n            if(count > maxi)\n            {\n                maxi = count;\n                max_idx = i;\n            }\n            else if(maxi == count)\n            {\n                maxi = count;\n                if(divisors[max_idx] >= divisors[i])\n                {\n                    max_idx = i;\n                }\n            }\n        }\n        return divisors[max_idx];\n    }\n};\n```
['C++']