Skip to content

Commit 82d88b8

Browse files
refactor 713
1 parent 6356f10 commit 82d88b8

File tree

1 file changed

+3
-19
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-19
lines changed

src/main/java/com/fishercoder/solutions/_713.java

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 713. Subarray Product Less Than K
5-
*
6-
* Your are given an array of positive integers nums.
7-
* Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less than k.
8-
9-
Example 1:
10-
Input: nums = [10, 5, 2, 6], k = 100
11-
Output: 8
12-
Explanation: The 8 subarrays that have product less than 100 are: [10], [5], [2], [6], [10, 5], [5, 2], [2, 6], [5, 2, 6].
13-
Note that [10, 5, 2] is not included as the product of 100 is not strictly less than k.
14-
Note:
15-
16-
0 < nums.length <= 50000.
17-
0 < nums[i] < 1000.
18-
0 <= k < 10^6.
19-
20-
*/
213
public class _713 {
224
public static class Solution1 {
23-
/**O(n^2) solution, accepted initially, then Leetcode added one test case to fail it.*/
5+
/**
6+
* O(n^2) solution, accepted initially, then Leetcode added one test case to fail it.
7+
*/
248
public int numSubarrayProductLessThanK(int[] nums, int k) {
259
int result = 0;
2610
for (int i = 0; i < nums.length; i++) {

0 commit comments

Comments
 (0)