Tap here to switch tabs
Problem
Submissions

Problem: Subarray Product Less Than K

Subarray Product Less Than K asks you to count all contiguous subarrays in a positive-integer array whose combined product is strictly less than a given threshold.

Statement

Given an array of integers nums and an integer k, return the number of contiguous subarrays such that the product of all elements in each subarray is strictly less than k.

Constraints:

  • 1≤1 \leq nums.length ≤3×104\leq 3 \times 10^4

  • 1≤1 \leq nums[i] ≤103\leq 10^3

  • 0≤0 \leq k ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Subarray Product Less Than K

Subarray Product Less Than K asks you to count all contiguous subarrays in a positive-integer array whose combined product is strictly less than a given threshold.

Statement

Given an array of integers nums and an integer k, return the number of contiguous subarrays such that the product of all elements in each subarray is strictly less than k.

Constraints:

  • 1≤1 \leq nums.length ≤3×104\leq 3 \times 10^4

  • 1≤1 \leq nums[i] ≤103\leq 10^3

  • 0≤0 \leq k ≤106\leq 10^6