diff --git "a/leetcode2/1easy/\352\271\200\353\214\200\354\233\220/Q2644.java" "b/leetcode2/1easy/\352\271\200\353\214\200\354\233\220/Q2644.java" new file mode 100644 index 00000000..6ec939d1 --- /dev/null +++ "b/leetcode2/1easy/\352\271\200\353\214\200\354\233\220/Q2644.java" @@ -0,0 +1,20 @@ +class Solution { + public int maxDivScore(int[] nums, int[] divisors) { + int score = Integer.MIN_VALUE; + int answer = Integer.MAX_VALUE; + for (int i = 0; i < divisors.length; i++) { + int divisor = divisors[i]; + int cnt = 0; + for (int j = 0; j < nums.length; j++) { + if (nums[j] % divisor == 0) cnt++; + } + + if (cnt > score || (cnt == score && divisor < answer)) { + score = Math.max(score, cnt); + answer = divisor; + } + } + + return answer; + } +} \ No newline at end of file