Skip to content

Commit 06c8b1c

Browse files
authored
Create 713. Subarray Product Less Than K (#441)
2 parents ccef2d6 + e21855e commit 06c8b1c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

713. Subarray Product Less Than K

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public:
3+
int numSubarrayProductLessThanK(vector<int>& v, int k) {
4+
int n=v.size();
5+
int ans=0;
6+
for(int i=0;i<n;i++) {
7+
int s=1;
8+
for(int j=i;j<n;j++) {
9+
s=s*v[j];
10+
if(s>=k)
11+
break;
12+
ans++;
13+
}
14+
}
15+
return ans;
16+
}
17+
};

0 commit comments

Comments
 (0)