Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays With LCM Equal to K

med
30 min
Try to solve the Number of Subarrays With LCM Equal to K problem.

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

med
30 min
Try to solve the Number of Subarrays With LCM Equal to K problem.

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