two pointers
Posted chucklu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了two pointers相关的知识,希望对你有一定的参考价值。
https://www.geeksforgeeks.org/container-with-most-water/
Approach :
- This implies that if there was a better solution possible, it will definitely have the Height greater than min(a1, aN).
- We know that, Base min(a1, aN)
This means that we can discard min(a1, aN) from our set and look to solve this problem again from the start. - If a1 < aN, then the problem reduces to solving the same thing for a2, aN.
- Else, it reduces to solving the same thing for a1, aN-1
以上是关于two pointers的主要内容,如果未能解决你的问题,请参考以下文章
Two Scoops Press Two Scoops of Django 1.11.pdf
[LeetCode] 349 Intersection of Two Arrays & 350 Intersection of Two Arrays II