Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 05 · DSA · Clinic: arrays, hashing and stacks · about 13 min to read

Play it as a journeyTutor comes with a plan

Clinic #17: Container With Most Water

Pattern: Two Pointers (converging) · LC 11

Container With Most Water
Container With Most Water · Open board

Nau khadi lakeerein, alag-alag oonchai ki, aur sawaal ye hai ki inmein se konsi do lakeerein milkar sabse zyada paani rok sakti hain.

Before you start. Array ek line mein rakhe numbers hote hain, aur index unki position ka number hai, pehla number index 0 pe baithta hai, doosra index 1 pe. Clinic #05: Two Sum mein tumne dekha tha ki sorted array pe dono sire se andar aana kaam karta hai. Yahan wahi tarkeeb lautegi, bas andar aane ka faisla ek naye niyam se hoga.

Lesson 41 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1840: Liebig ka barrel, sabse chhoti takhti hi paani ki satah tay karti hai
  • Do khadi lakeerein, ek sawaal: konsi jodi sabse zyada paani rokegi?
  • Bottleneck khud dhoondo: chhoti line move karo, lambi kabhi nahi
  • Do pointers, dono sire se andar aate hain
  • 0 · Problem + Constraints
  • 1 · Saboot, teen line mein, kyun chhoti line chhodna safe hai
  • 2 · Invariant
  • 3 · Solution Ladder
  • 4 · Trace: height=[1,8,6,2,5,4,8,3,7]
  • 5 · Interview mein pehli baar, raasta
  • 6 · The Tell
  • Chala ke dekho: brute, two pointers, aur do galat chaalein
  • Edge cases, aur do bug
  • Trace, print karke
  • Invariant, theek shabdon mein
  • Ghadi
  • Retrieval

Terms it explains: LC 11, index, O(n²), Pointer, O(n), chhoti line, two pointers, BEST, Clarify, Brute bolo, Widest se shuru, INSIGHT, Code, Edge, Converging two pointers, provable, monotone, fix, phir, pehle, top, baad, Trapping Rain Water, 3Sum.

Review DSA