当前位置:网站首页>14. Double pointer - the container that holds the most water
14. Double pointer - the container that holds the most water
2022-07-28 10:17:00 【[email protected]】

public int maxArea(int[] height) {
int low = 0, high = height.length-1, temp = 0, max = 0;
while(low < high){
if(height[low] < height[high]){
temp = (high-low) * height[low];
low++;
}
else{
temp = (high-low) * height[high];
high--;
}
if(temp > max){
max = temp;
}
}
return max;
}
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207280958223725.html
边栏推荐
猜你喜欢

21. 合并两个有序链表

Why should I take the first-class constructor examination? How high is the gold content of the first-class Constructor Certificate?

PHP生成二维码(学习)
![[learning notes] border and period](/img/a4/5493f7eefc7dd0e38bc9a53a92b87b.png)
[learning notes] border and period

Choosing a supplier service system is the first step for large health industry enterprises to move towards digital transformation

利用正则表达式从文件路径中匹配文件名

Skillfully use NGX_ Lua makes traffic grouping

Performance test of API gateway APIs IX in Google cloud T2a and T2D

In retaliation for the dismissal of the company, I changed all code comments of the project!

19. 删除链表的倒数第 N 个结点
随机推荐
华为入股石墨烯材料厂商富烯科技,持股10%
[jzof] 14 cut rope
多线程与高并发(三)—— 源码解析 AQS 原理
Description of landingsite electronic label quppa firmware entering DFU status
Digital transformation scheme of real estate: all-round digital intelligence system operation, helping real estate enterprises improve the effectiveness of management and control
JWT login authentication + token automatic renewal scheme, well written!
It's settled! On July 30!
What are the advantages of MRO purchasing website for industrial products? One article will help you understand
Joint search set
Detailed explanation of thread synchronization volatile and synchronized
银行入职考试要点汇总
12、双指针——合并两个有序链表
Oracle中的小知识
LinkedList源码按摩,啊舒服
我用小程序容器让移动研发效率提升了5倍!
[openharmony] [rk2206] build openharmony compiler (2)
巧用ngx_lua做流量分组
2022 uni app parsing token standard - use jsrsasign - climb the pit
Redis设计规范
按位与、或、异或等运算方法