You have a row of walls. Pick any two, and the water between them fills to the height of the shorter wall. Width times water level gives the area. Simple formula. The hard part is finding the pair that maximizes it without checking all n*(n-1)/2 possibilities.
Start by picking some pairs. Build intuition for what makes a good container before we look for a pattern.
Tap two walls to form a container.0 pairs checked