Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays With LCM Equal to K

Number of Subarrays With LCM Equal to K asks you to count contiguous, nonempty subarrays of an integer array whose least common multiple equals the given k, and returns the total.

Statement

Given an integer array nums and an integer k, return the number of subarrays of nums where the least common multiple of all elements in the subarray is equal to k.

Note: A subarray is defined as a contiguous non empty sequence of elements within an array. The least common multiple of an array of numbers is the smallest positive integer that is evenly divisible by all elements in that array.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i], k ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays With LCM Equal to K

Number of Subarrays With LCM Equal to K asks you to count contiguous, nonempty subarrays of an integer array whose least common multiple equals the given k, and returns the total.

Statement

Given an integer array nums and an integer k, return the number of subarrays of nums where the least common multiple of all elements in the subarray is equal to k.

Note: A subarray is defined as a contiguous non empty sequence of elements within an array. The least common multiple of an array of numbers is the smallest positive integer that is evenly divisible by all elements in that array.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i], k ≤1000\leq 1000