create account

Coding Exercise - Container With Most Water (Recursion) 编程练习题 - 最多水容器 (递归) by justyy

View this thread on: hive.blogpeakd.comecency.com
· @justyy · (edited)
$5.55
Coding Exercise - Container With Most Water (Recursion) 编程练习题 - 最多水容器 (递归)
> 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 (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
Note: You may not slant the container and n is at least 2.

![](https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg)

> 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 can contain is 49.
> Example: Input: [1,8,6,2,5,4,8,3,7] Output: 49

Reposted to [my blog: XXX](https://helloacm.com/coding-exercise-container-with-most-water-recursion/) for better indexing.

## Support me and my work as a witness - [witness thread](https://steemit.com/witness-category/@justyy/justyy-just-another-witness) by 
1. voting me [here](https://steemconnect.com/sign/account_witness_vote?approve=1&witness=justyy), or
2. voting me as [a proxy](https://v2.steemconnect.com/sign/account-witness-proxy?proxy=justyy&approve=1).

Thank you! **Some of My Contributions: [SteemIt Tutorials, Robots, Tools and APIs](https://helloacm.com/tools/steemit/)**

------------------------------------------------
XXX原文: [https://justyy.com/archives/6431](https://justyy.com/archives/6431)

## 支持我的工作 支持我成为 [见证人](https://steemit.com/cn/@justyy/5h6gyv-cn) 
1. [请在 这里 投我一票](https://steemconnect.com/sign/account_witness_vote?approve=1&witness=justyy), 或者
2. 设置我 [为代理](https://v2.steemconnect.com/sign/account-witness-proxy?proxy=justyy&approve=1).

谢谢您! 我的贡献:[SteemIt 工具、API接口、机器人和教程](https://helloacm.com/tools/steemit-tools/)

## 股东工具
1. 成为股东:[代理5 SP 即可 (退出股东 输入 0即可)](https://helloacm.com/tools/steemit/delegate-form/?delegatee=justyy)
2. [查询当前股东](https://helloacm.com/tools/steemit/list-of-delegators/?id=justyy)

请注意:每次代理都是以最后一次输入的SP数量为标准,比如已经代理10 SP,想多代理5 SP则需要输入 最后的数字 15 SP(而不是 5!)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 90 others
properties (23)
authorjustyy
permlinkcoding-exercise-container-with-most-water-recursion
categoryprogramming
json_metadata{"community":"busy","app":"steemit/0.1","format":"markdown","tags":["programming","coding-exercise","cn-programming","busy","coding"],"links":["https://helloacm.com/coding-exercise-container-with-most-water-recursion/","https://steemit.com/witness-category/@justyy/justyy-just-another-witness","https://steemconnect.com/sign/account_witness_vote?approve=1&witness=justyy","https://v2.steemconnect.com/sign/account-witness-proxy?proxy=justyy&approve=1","https://helloacm.com/tools/steemit/","https://justyy.com/archives/6431","https://steemit.com/cn/@justyy/5h6gyv-cn","https://helloacm.com/tools/steemit-tools/","https://helloacm.com/tools/steemit/delegate-form/?delegatee=justyy","https://helloacm.com/tools/steemit/list-of-delegators/?id=justyy"],"image":["https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg"]}
created2018-07-25 18:57:48
last_update2018-11-15 20:04:30
depth0
children1
last_payout2018-08-01 18:57:48
cashout_time1969-12-31 23:59:59
total_payout_value4.826 HBD
curator_payout_value0.719 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,964
author_reputation280,616,224,641,976
root_title"Coding Exercise - Container With Most Water (Recursion) 编程练习题 - 最多水容器 (递归)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id65,961,900
net_rshares2,734,685,012,962
author_curate_reward""
vote details (154)
@ilovecoding ·
Hello! Your post has been resteemed and upvoted by @ilovecoding because **we love coding**! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On! 
 ![](https://codingforspeed.com/images/i-love-coding.jpg) 
*Reply !stop to disable the comment. Thanks!*
👍  
properties (23)
authorilovecoding
permlink20181115t200442056z
categoryprogramming
json_metadata{"tags":["ilovecoding"],"app":"ilovecoding"}
created2018-11-15 20:04:42
last_update2018-11-15 20:04:42
depth1
children0
last_payout2018-11-22 20:04:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length323
author_reputation40,845,997,808
root_title"Coding Exercise - Container With Most Water (Recursion) 编程练习题 - 最多水容器 (递归)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id75,352,564
net_rshares382,813,849
author_curate_reward""
vote details (1)