[LeetCode]Container With Most Water

中国银行信息科技岗位笔试 收到笔试只剩四天了,收集的资料,后续会更新 阅读详情
class Solution {
//Find two lines, which together with x-axis forms a container, such that the container contains the most water.
//if do not together with x-axis forms a container, 
//and together with other lines then it will be more difficult to find out an effective solution
public:
	int maxArea(vector<int> &height) {
		// Start typing your C/C++ solution below
		// DO NOT write int main() function
		int l = 0;
		int r = height.size()-1;
		int ans = 0;
		while (l < r)
		{
			int tmp = min(height[r], height[l])*(r-l);
			if(tmp > ans) ans = tmp;
			if(height[r] < height[l])
				r--;
			else l++;
		}
		return ans;
	}
};

second time

class Solution {
//greedy based solution
public:
    int maxArea(vector<int> &height) {
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        int left = 0, right = height.size()-1;
        int maxArea = 0;
        while(left < right)
        {
            maxArea = max(maxArea, min(height[left], height[right])*(right-left));
            if(height[left] < height[right]) left++;
            else right--;
        }
        
        return maxArea;
    }
};


S32DS新建工程、编译调试下载、导入工程详细介绍 新建了一个工程之后,下面简单介绍下基本的UI界面。其中最左下角那个是界面,这个界面很重要,是图形化配置界面,然后可以根据这些配置自动生成代码。其中,左边那些配置文件,都是系统帮我们创建好了的,我们其实可以直接用就行。有PE工具的调试,以及Jlink工具的调试。我目前使用到PE工具调试可以查看寄存器值,而Jlink调试查看不了寄存器值。连接了开发板之后,点击Debug就可以吧程序下载到芯片上了,而且可以进入到调试界面。 阅读详情

相关推荐

Abaqus中Cohesive单元建模:从本构到失效的完整指南

本文提供了Abaqus中Cohesive单元建模的完整指南,涵盖从本构模型到失效分析的全过程。详细解析了Cohesive单元作为模拟界面粘结与失效的关键工具,其核心在于弹性本构、损伤起始准则和损伤演化定律的设置。文章通过双悬臂梁(DCB)实例,手把手指导前处理、材料定义、求解设置及后处理分析,并分享了刚度、强度、断裂能等关键参数的影响与收敛性调优的实用避坑技巧,帮助用户准确模拟复合材料及胶接结构的界面失效行为。

cuda7parallel的博客 701

【LeetCode】解题11:Container With Most Water

LeetCode解题 11:Container With Most Water Problem 11: Container With Most Water [Medium]解题思路1. 暴力求解2. 双指针Solution (Java) Problem 11: Container With Most Water [Medium] Given n non-negative integers a1, ...

Fayedily的博客 251

《最游记》游戏开发全栈指南:从源码解析到实战部署

本文提供了一份详尽的《最游记》游戏源码全栈开发指南。文章深入解析了这款3D玄幻网游的完整源码结构,涵盖客户端、服务端、引擎和工具链,并提供了从环境搭建、核心模块解析到实战修改与部署的完整流程。对于希望深入理解MMORPG架构的开发者而言,这份指南是宝贵的实战资源。

weixin_28363123的博客 74

leetcode题目11. Container With Most Water

leetcode题目11. Container With Most WaterNote:Example:CODE: #题目简介 Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that ...

zydapangzi的博客 209

同步辐射材料科学应用指南:从XAFS原位实验到数据处理

材料结构分析是材料研究的核心环节,但传统实验室X射线受限于能量固定、亮度不足,往往难以回答原子局域配位、非晶结构及动态演变等关键问题。同步辐射光源以高通量、连续可调、偏振可控及脉冲时间结构等特性,将材料表征从静态观察推进到原位动态追踪层次。基于X射线吸收精细结构谱(XAFS)、原位实验、X射线衍射与散射、微区成像等技术,研究人员可实现元素选择性分析、近邻原子环境解析及真实工况下的结构演变监测。本文从技术原理出发,覆盖实验方案设计、样品制备、现场对光、数据处理与常见故障排查,并结合典型应用场景,为材料科学领域

weixin_32612263的博客 173

esim分布式云卡池技术

eSIM卡,即Embedded-SIM,嵌入式SIM卡。eSIM卡的概念就是将传统SIM卡直接嵌入到设备芯片上,而不是作为独立的可移除零部件加入设备中,用户无需插入物理SIM卡。这一做法将允许用户更加灵活的选择运营商套餐,或者在无需解锁设备、购买新设备的前提下随时更换运营商。未来通用的eSIM标准建立将为普通消费者、企业用户节省更多移动设备使用成本,并带来更多的便利、安全性。 2018年 3月7日,中国联通宣布,正式在上海、天津、广州、深圳、郑州、长沙6座城市率先启动“eSIM一号双终端”业务的办理。[.

著名博客 3710

Leetcode之Container With Most Water 问题

问题描述: Given n non-negative integers a1,a2, ...,an, where each represents a point at coordinate (i,ai).n vertical lines are drawn such that the two endpoints of linei is at (i,ai) and (i, 0). Find

漫漫学习路 371

【文本分析学习】Anaconda+pytorch虚拟环境下的pycharm文本分析(含分词、词性标注、词形归一化、停用词、文本情感分析、词频、文本相似度,附数据代码) NLTK

文本分析学习之 Anadconda+pytorch虚拟环境下的pycharm文本分析(含分词、词性标注、词形归一化、停用词、文本情感分析、词频、文本相似度,附数据代码)

littlexmj的博客 2333

【LeetCode】11. Container With Most Water 解题报告

转载请注明出处:http://blog.youkuaiyun.com/crazy1235/article/details/51541984Subject 出处:https://leetcode.com/problems/container-with-most-water/ Given n non-negative integers a1, a2, …, an, where each represents

crazy_jack 6048

恶意代码实验3:Word宏病毒实验

只要下次打开这个word文档,就会执行以上代码,并将自身复制到Normal.dot(word文档的公共模板)和当前文档的ThisDocument中,同时改变函数名(模板中为Document_Close,当前文档为Document_Open),此时所有的word文档打开和关闭时,都将运行以上的病毒代码,可以加入适当的恶意代码,影响word的正常使用,本例中只是简单的跳出一个提示框。回答不正确三次,即可自动跳出病毒程序,但那时已经出现几十个文档。1、打开的宏编辑器如图所示,即可编写病毒代码。

qq_63949327的博客 6506

信贷系统学习总结(6)—— 贷前、贷中、贷后全流程核心模型解析

本文系统解析了金融风控模型的技术演进与应用实践。从贷前、贷中到贷后全流程,详细介绍了A卡、B卡、C卡三类核心评分模型,以及反欺诈、动态监控、催收优化等关键技术的实现路径。重点阐述了特征工程设计、模型验证指标、联邦学习等创新应用,并提供了多个实战案例数据。同时提出了算法选择的"黄金三角"原则和分阶段技术演进路线,强调数据治理、模型全生命周期管理和复合型团队建设的重要性。文章指出未来风控将向决策智能化、数据无感化和风险预知化方向发展,需要平衡技术创新与合规要求。

科技D人生 1222

Leetcode 11. Container With Most Water

题目描述:找出两个柱子,使其两根柱子面积最大,就是找两个数,使两个面积最大,就是宽*高最大。 题目链接:Leetcode 11. Container With Most Water 子串、子数组的题目,暴力求解,列举子集之后就可以得出结果,不断更新。 还有一个C++的解法那就是左右指针,如何向左向右条件如下。 代码如下 class Solution { public int maxA...

Za七杂⑧ 205

基于Python的京东商品价格监控与降价提醒系统设计与实现

本文详细介绍了如何使用Python构建一个完整的京东商品价格监控与降价提醒系统。系统通过爬虫技术实时抓取京东商品价格信息,结合数据存储与分析,实现价格波动监控和智能降价提醒功能。文章涵盖了系统设计、技术选型、代码实现以及部署方案,为电子商务价格监控领域提供了一个实用的解决方案。关键词:Python爬虫、京东API、价格监控、降价提醒、自动化。

2201_76125261的博客 405

[LeetCode] 011. Container With Most Water (Medium) (C++/Java/Python)

[LeetCode] 011. Container With Most Water (Medium) (C++/Java/Python)

水果君の日常 2387

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

Leetcode11:Container With Most Water

Leetcode11 Container With Most Water Container With Most Water The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container ...

qq_24367757的博客 189

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Leetcode 11 Container With Most Water

Leetcode 11 Container With Most Water class Solution{ public: int maxArea(vector&lt;int&gt;&amp; height){ int left = 0; int right = height.size()-1; int max_area = 0; while(right &g...

自己的学习笔记 201

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

leetcode011 Container With Most Water

题目11. Container With Most Water Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at

jnuyanfa的博客 356

leetcode解题报告11. Container With Most Water

leetcode解题报告11. Container With Most Water题目地址 难度是medium题目描述原文: Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that th

sysu_xiaoming的博客 274

leetcode记录11.Container With Most Water

leetcode记录11.Container With Most Water # # @lc app=leetcode id=11 lang=python3 # # [11] Container With Most Water # # https://leetcode.com/problems/container-with-most-water/description/ # # algorithm...

我的博客 214

LeetCode | Container With Most Water

11. Container With Most Water Description Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints o...

Karmen199x的博客 152

LeetCode11. Container With Most Water

11. Container With Most Water 1、原题 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints

u010217031的博客 323

[leetcode]11. Container With Most Water

[leetcode]11. Container With Most Water Analysis 是阴天呢—— [每天刷题并不难0.0] Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn s...

weixin_32135877的博客 145

LeetCode:11. Container With Most Water

LeetCode:11. Container With Most Water Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of li...

Wisimer 217

Container With Most Water - LeetCode

Container With Most Water - LeetCode 题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp

不要说话的博客 696

Leetcode - 11 - Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a cont.

xin_rong的博客 147

Leetcode1-50: 11. Container With Most Water

Leetcode1-50: 11. Regular Expression Matching问题描述解题思路Brute force线性算法代码实现implement 1 Brute forceimplement 2 线性算法复杂度分析分析 问题描述 Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such t

Y123iwantit的博客 232
上一篇: [LeetCode]Construct Binary Tree from Preorder and Inorder Traversal
下一篇: [LeetCode]Convert Sorted Array to Binary Search Tree
AI记忆
AI记忆 优质创作者: 人工智能技术领域 优质创作者: 人工智能技术领域 领域专家: 算法与数据结构技术领域 领域专家: 算法与数据结构技术领域
博客等级 码龄19年 6685粉丝 429原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI记忆

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值