init thoughts:
as im going to start keeping these notes (or transposing them? ) on a blog, i thought it would be helpful to keep my initial thoughts for others and for myself. SO - containter with most water.
biolded down, i seems like a pretty easy question - out of this given list, what range do most of the numbers fall under. and then what are those two numbers multiplied?
ex |
given: [] 1,7,2,5,4,7,3,6]
ans : most numbers are between 7 and 6
ans : return 7 * 6
wahhhh wait i might have misunderstood the question...
yeah i diddddd
Each number in the array is a vertical bar. You're picking two bars to act as the walls of a container, and checking how much water it can hold.
Water amount = width × height, where:
- width = distance between the two bars (index difference)
- height = the shorter of the two bars (water spills over the shorter wall)
i was only thinking of widthhh damn geometery.
hmm okay, so. pointers then. start on left and right, multiply the numbers together and record the heighest is the brute force method....
could use my misconseption eariler - check the pairs with the best range between them then compare form the smaller list.
so [ 1,7,2,5,4,7,3,6] -> [1,6] [7,7] [7,6]
then multply those... but i'd need to keep track of the indeces two...
could keep track of the largest l and right #,
each time a max l or r is found, them multply. if that sum is greater then the current - save it. if not, let it go.
this would iterate over the array only once, but create at least 3 new memory address (max_sum, max_l, max_r) as l and r would be handled by the for loop.
not my cleanest idea imo,,, but i could try it?
use left and right,
max = sum : [ l , r]
bro i literally had a dream about this one and i still don't understand :((((
watching a vid, i'll put my notes here ----
These Notes Were Last updated: 13-03-2026