In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will introduce in detail for you "how to use java to solve the problem of holding the largest number of water containers", the content steps are clear and detailed, and the details are handled properly, and the editor will update different knowledge points every day. I hope that this article "how to use java to solve the problem of holding most water containers" can give you unexpected harvest.
Given n non-negative integers A1 ai a2, each number represents a point (I, point) in the coordinates. Draw n vertical lines in the coordinates. The two endpoints of the vertical line I are (I, ai) and (I, 0), respectively. Find two of the lines so that the container composed of them and the x-axis can hold the most water.
Note: you cannot tilt the container, and the value of n is at least 2.
The vertical line in the picture represents the input array [1, 8, 6, 2, 5, 5, 4, 8, 3, 7]. In this case, the maximum value that the container can hold water (represented as the blue part) is 49.
Example:
Input: [1, 8, 6, 2, 5, 4, 8, 3, 7]
Output: 49
Parsing:
It seems more difficult to have no comments from individual feedback, so from this issue, if time permits, I will try my best to add comments. I will write comments for the first time, for fear that I will not understand them, so I will be verbose and adjust them later.
What can Java be used for? Java is mainly used in: 1. Web development; 2. Android development; 3. Client development; 4. Web page development; 5. Enterprise application development; 6. Java big data development; 7. Game development and so on.
If you can read this, the editor hopes that you will have the most profound experience from the practical level on the key issue of "how to use java to solve the problem of holding the most water containers". If you want to read more related articles, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.