当前位置:网站首页>Leetcode 713. Subarray double pointers whose product is less than k
Leetcode 713. Subarray double pointers whose product is less than k
2022-06-09 02:41:00 【Confident little screw】
Original link :Leetcode 713. The product is less than K Subarray 
class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
int l=0,r=0,tmp=1,res=0;
while(r<nums.size())
{
tmp*=nums[r++];
while(l<r && tmp>=k) tmp/=nums[l++];
res+=(r-l);
}
return res;
}
};
边栏推荐
- [network protocol] | [01] network byte order big end and small end
- Redis data storage
- 杰理之SPI 从机如何配置驱动程序?【篇】
- How to modify ad_ Key connected pin? [chapter]
- LeetCode 1155. N ways to roll dice**
- Modbus RTU communication routine between Delta Eh3 series PLC and thermostat
- Basic architecture of data Lake
- 独家 | 维信金科申请消费金融牌照未果
- gradle 查看某个包的依赖树
- 杰理之若用户不需要使用所有的按键,其他按键应该如何设置?【篇】
猜你喜欢

4426 divisible substring (enumeration + number theory)

Go技術日報(2022-06-07)——go程序員開發效率神器匯總
![[homeassistant Internet access (cpolar)]](/img/37/063986d7d855a1803a7a1a108f7134.png)
[homeassistant Internet access (cpolar)]

Karmada v1.2 release: open a new era of full-text search

【HomeAssistant外网访问(cpolar)】

Golang of knowledge sharing -- a function based on whether a folder exists and whether a file exists

C# 基础篇

Redis集群搭建

Jsnpp框架的全链式语法初探

Self implemented web server
随机推荐
In unity, inherit the lifecycle of monobehavior game objects
[network protocol] | [01] network byte order big end and small end
Geotrust证书价格
进程与线程
pkg-config --modversion opencvPackage opencv was not found in the pkg-config search path. Perhaps y
Jerry's SPI host [chapter]
export相關知識
How to implement the project practice of user registration, login and logout in flask + MySQL
Basic method of missing data filling (1) -- k-nearest neighbors (KNN) filling
杰理之如何修改 ad_key 连接的引脚?【篇】
Karmada v1.2 release: open a new era of full-text search
4426 divisible substring (enumeration + number theory)
Formatting and parsing of simpledateformat time
Basic usage of flask sqlalmy
Vins estimator 5-point method
Greedy method / non 01 knapsack problem
How does Jerry's SPI host configure the driver? [chapter]
Range of acwing 789 numbers
(10.3)【隐写缓解】隐写防护、隐写干扰、隐写检测
TypeScript 基础类型 —— 类型断言