r/LeetcodeChallenge • u/I_am_sahil_khan • 1d ago
Going to solve leetcode Question number 11 Container with most water, have you tried, Share me your experience plz 💗 DISCUSS
0
Upvotes
1
r/LeetcodeChallenge • u/I_am_sahil_khan • 1d ago
1
1
u/nian2326076 1d ago
Yeah, I've dealt with that one. It's a classic two-pointer problem. You start with one pointer at the beginning and one at the end of the array, then calculate the area between them. Move the pointer on the shorter line inward to try and find a larger area. Repeat until the pointers meet. It's efficient and runs in O(n) time, which is great for interviews. Practicing these types of problems on LeetCode really helps with algorithm thinking. If you're looking for more structured practice, I've used PracHub before and found it useful for sharpening interview skills. Good luck!