自学内容网 自学内容网

Java LeetCode 每日一题

        3162. 优质数对的总数 I

package JavaExercise20241010;

public class JavaExercise {
}

class Solution {
    public int numberOfPairs(int[] nums1, int[] nums2, int k) {
        int sum = 0;
        int length1 = nums1.length;
        int length2 = nums2.length;
        for (int i = 0; i < length1; i++) {
            for (int j = 0; j < length2; j++) {
                if (nums1[i] % (nums2[j] * k) == 0) {
                    sum++;
                }
            }
        }
        return sum;
    }
}


原文地址:https://blog.csdn.net/Aishangyuwen/article/details/142834990

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!