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.js文档阅读笔记-two.js的基本使用

Two Scoops Press Two Scoops of Django 1.11.pdf

[LeetCode] 349 Intersection of Two Arrays & 350 Intersection of Two Arrays II

1. Two Sum

URAL 1495 One-two, One-two 2

周刷题第一期总结(two sum and two numbers)